Skip to content

Conversation

@kodsurfer
Copy link

@kodsurfer kodsurfer commented Sep 30, 2025

Summary by CodeRabbit

  • Chores
    • Added automated CSS validation in CI that runs on pushes and pull requests to catch styling issues early.
    • Introduced a local stylelint build step that ensures required dependencies are installed and runs linting with automatic fixes for stylesheets.
    • No direct UI changes; this reduces visual regressions and improves style consistency.

@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

Walkthrough

Adds a GitHub Actions workflow that downloads and runs the W3C CSS Validator on target/css/main.css, and updates the Makefile to add a stylelint target that depends on the local node_modules binary and runs stylelint in fix mode (ensuring npm install as a prerequisite).

Changes

Cohort / File(s) Summary
GitHub Actions CI
.github/workflows/csscheck.yml
New workflow "css validation" triggered on push and pull_request; job validate-css runs on ubuntu-latest, checks out the repo, downloads the W3C CSS Validator jar, and executes java -jar css-validator.jar target/css/main.css.
Local tooling / Makefile
Makefile
Adds stylelint Make target that depends on the local binary node_modules/.bin/stylelint (ensuring npm install runs); invokes the local stylelint in fix mode against sass/*.scss and updates target dependency chain to use the local binary.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant GH as GitHub
    participant Runner as Runner (ubuntu-latest)
    participant Checkout as actions/checkout@v4
    participant FetchJar as Download css-validator.jar
    participant Java as Java (java -jar)

    Dev->>GH: push / open PR
    GH->>Runner: trigger "css validation"
    Runner->>Checkout: checkout repository
    Checkout-->>Runner: workspace ready
    Runner->>FetchJar: curl/download css-validator.jar
    FetchJar-->>Runner: jar saved
    Runner->>Java: java -jar css-validator.jar target/css/main.css
    Java-->>Runner: validation result (pass/fail)
    Runner-->>GH: report job status
Loading
sequenceDiagram
    participant Dev as Developer
    participant Shell as Local Shell / CI
    participant NPM as npm (install)
    participant Stylelint as node_modules/.bin/stylelint

    Dev->>Shell: run `make stylelint`
    Shell->>NPM: ensure `npm install` (provides local binaries)
    NPM-->>Shell: local binaries present
    Shell->>Stylelint: run `./node_modules/.bin/stylelint --fix sass/*.scss`
    Stylelint-->>Shell: lint results / fixes
    Shell-->>Dev: exit code / output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I hop to the repo, nose all a-twitch,
A jar for the CSS and a linting switch.
I fix little styles with a flick and a thump,
CI hums softly — carrots for the triumph! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "Add css validation" directly relates to the main changes in the pull request. The changeset adds CSS validation capabilities through a new GitHub Actions workflow file (csscheck.yml) that uses the W3C CSS Validator, and updates the Makefile to support stylelint for SCSS files. The title is concise, clear, and specific enough for a developer scanning git history to understand that CSS validation functionality is being introduced. While the title could be slightly more specific (e.g., mentioning GitHub Actions or the tools used), it accurately captures the essence of the primary change without being misleading or overly vague.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff02e40 and 202c1e0.

📒 Files selected for processing (1)
  • .github/workflows/csscheck.yml (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: copyrights
.github/workflows/csscheck.yml

[warning] 1-1: Missed: CSS check workflow was not triggered (csscheck.yml).

🪛 GitHub Actions: yamllint
.github/workflows/csscheck.yml

[warning] 1-1: YAML lint warning: missing document start '---' (document-start).


[warning] 3-3: YAML lint warning: truthy value should be one of [false, true] (truthy).


[error] 9-9: YAML lint error: wrong indentation: expected 6 but found 4 (indentation).

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: make

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
.github/workflows/csscheck.yml (1)

1-1: Add YAML document start marker.

The yamllint tool expects YAML files to start with the --- document start marker.

Apply this diff:

+---
 name: css validation
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 202c1e0 and 4cee4fb.

📒 Files selected for processing (1)
  • .github/workflows/csscheck.yml (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: copyrights
.github/workflows/csscheck.yml

[warning] 1-1: Missed: CSS checks workflow (csscheck.yml) was not executed.

🪛 GitHub Actions: yamllint
.github/workflows/csscheck.yml

[warning] 1-1: yamllint: missing document start '---'.


[warning] 3-3: yamllint: truthy value should be one of [false, true].


[error] 3-3: yamllint: trailing spaces.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: make

@yegor256
Copy link
Member

@kodsurfer what's with this one? ready to finish it?

@kodsurfer
Copy link
Author

@yegor256 work in progress, I hope to finish soon

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/csscheck.yml (1)

15-18: Add Java version specification and input validation.

The workflow uses java without specifying a version, which can lead to unpredictable behavior if the Java environment changes. Consider setting up a specific Java version. Additionally, add validation to ensure the CSS file exists and provide clear error messages if prerequisites are missing.

     steps:
       - uses: actions/checkout@v4
+      - name: Set up Java
+        uses: actions/setup-java@v4
+        with:
+          java-version: '11'
+          distribution: 'temurin'
       - name: Validate CSS with W3C Jar
         run: |
           wget -O css-validator.jar \
             https://github.com/w3c/css-validator/releases/download/cssval-20250226/css-validator.jar
+          
+          # Fail fast if CSS file is missing
+          if [ ! -f target/css/main.css ]; then
+            echo "Error: target/css/main.css not found. Ensure the CSS build step runs before validation."
+            exit 1
+          fi
+          
           java -jar css-validator.jar file:target/css/main.css
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 08fc3e3 and 5663d4a.

📒 Files selected for processing (1)
  • .github/workflows/csscheck.yml (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: yamllint
.github/workflows/csscheck.yml

[warning] 6-6: truthy value should be one of [false, true] (truthy)


[error] 17-17: line too long (124 > 80 characters) (line-length)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: make
🔇 Additional comments (1)
.github/workflows/csscheck.yml (1)

6-8: Verify event trigger configuration.

The yamllint tool reports a truthy value warning on line 6. The explicit object syntax for event triggers is correct; however, confirm there is no trailing whitespace or hidden characters on the on: line that may trigger this warning.

Run the following script to verify the YAML structure and diagnose the truthy warning:

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ba0f9f and 6368895.

📒 Files selected for processing (1)
  • Makefile (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: css validation
Makefile

[error] 70-70: Makefile:70: node_modules/.bin/stylelint failed with exit code 254

🪛 GitHub Actions: make
Makefile

[error] 70-70: Make target 'node_modules/.bin/stylelint' failed. Command 'make' failed at Makefile:70 with exit code 254.

Comment on lines +71 to +75
node_modules/.bin/stylelint:
npm install

stylelint: node_modules/.bin/stylelint
./node_modules/.bin/stylelint stylelint sass/*.scss --fix
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Fix incorrect Make target declaration and malformed stylelint command.

The current implementation has two critical issues causing the pipeline failure (exit code 254):

  1. Line 71: node_modules/.bin/stylelint is declared as a target but not marked .PHONY. Make treats non-phony targets as files to be created; the recipe npm install doesn't directly create this file path, causing Make to incorrectly determine whether the target was successfully built.

  2. Line 75: The stylelint command has a malformed argument: stylelint stylelint sass/*.scss --fix. The second stylelint is being passed as an argument to the executable (treating it as a file to lint), rather than being part of the recipe itself.

Use one of these corrected approaches:

Option 1 (Recommended): Track npm_modules via package.json

-node_modules/.bin/stylelint:
-	npm install
-
-stylelint: node_modules/.bin/stylelint
-	./node_modules/.bin/stylelint stylelint sass/*.scss --fix
+node_modules: package.json
+	npm install
+
+stylelint: node_modules
+	./node_modules/.bin/stylelint sass/*.scss --fix

This ensures npm install only runs when dependencies change.

Option 2 (If npm_modules should always be checked): Use .PHONY with explicit check

-.PHONY: clean all assets install rake stylelint test entries
+.PHONY: clean all assets install rake stylelint test entries node_modules
-node_modules/.bin/stylelint:
+node_modules:
 	npm install
-
-stylelint: node_modules/.bin/stylelint
-	./node_modules/.bin/stylelint stylelint sass/*.scss --fix
+
+stylelint: node_modules
+	./node_modules/.bin/stylelint sass/*.scss --fix
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
node_modules/.bin/stylelint:
npm install
stylelint: node_modules/.bin/stylelint
./node_modules/.bin/stylelint stylelint sass/*.scss --fix
node_modules: package.json
npm install
stylelint: node_modules
./node_modules/.bin/stylelint sass/*.scss --fix
🤖 Prompt for AI Agents
In Makefile around lines 71 to 75, the Make target and stylelint invocation are
wrong: mark the prerequisite that doesn't correspond to a file as .PHONY or
(preferably) track node_modules via package.json, and fix the malformed
stylelint command that passes "stylelint" as an argument. Fix by replacing the
current target with one of two approaches: Option 1 (recommended) — declare a
target that depends on package.json (or package-lock.json/yarn.lock) so npm
install runs only when deps change, e.g. target: package.json -> run npm ci/ npm
install, then run the stylelint binary path with the correct files list (remove
the extra "stylelint" token) and --fix; Option 2 — if you must keep a phony
target for node_modules, add .PHONY: node_modules/.bin/stylelint and update the
recipe to explicitly check/install (npm ci) then invoke
./node_modules/.bin/stylelint sass/*.scss --fix (no extra "stylelint" token).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants