Skip to content

Include misc improvements - #6

Merged
j9t merged 6 commits into
mainfrom
refactor/misc
Jul 12, 2026
Merged

Include misc improvements#6
j9t merged 6 commits into
mainfrom
refactor/misc

Conversation

@j9t

@j9t j9t commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added --ignore-path/-p and ignorePaths configuration support for excluding files by relative path.
    • Added MIT licensing and released version 1.3.0.
    • Improved duplicate detection for equivalent time and angle values, and reordered min()/max() arguments.
  • Bug Fixes

    • Invalid single-dash long options now receive clear rejection and suggestions.
    • --fix warns when source maps may become outdated.
  • Performance

    • Multiple files are read concurrently while reports remain deterministic.
  • Documentation

    • Expanded CLI, configuration, API, algorithm, and aggressive-mode guidance.

j9t added 3 commits July 12, 2026 14:53
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Introduce `--ignore-path`/`-p` flag and `ignorePaths` config option to exclude files by path, matched relative to the working directory. Enhance `--fix` to warn if source maps are referenced but not regenerated, and implement concurrent file read prefetching for optimized multi-file processing. Add tests to validate these new functionalities and update documentation accordingly.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Add support for canonicalizing `<time>` values (e.g., `s` to `ms`) and sorting `min()`/`max()` arguments for consistency. Enable `<angle>` value normalization in aggressive mode, including exact and rounded conversions. Update tests, documentation, and changelog to reflect these improvements.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@j9t, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b21ba14c-1068-4569-b1e9-79629cf13be7

📥 Commits

Reviewing files that changed from the base of the PR and between 6adf1ed and 8e0452c.

📒 Files selected for processing (5)
  • README.md
  • bin/css-dedup.js
  • bin/css-dedup.test.js
  • package.json
  • src/normalization.js

Walkthrough

Version 1.3.0 adds CSS normalization rules, CLI ignore-path filtering, concurrent file prefetching, source-map warnings, MIT licensing, updated documentation, and aligned warning terminology.

Changes

CLI and normalization release

Layer / File(s) Summary
Value canonicalization and validation
src/normalization.js, bin/css-dedup.test.js, README.md
Time and aggressive angle units are canonicalized, min() and max() arguments are sorted, and related analysis cases and documentation are added.
CLI option handling and file processing
bin/css-dedup.js, bin/css-dedup.test.js, README.md
Single-dash long options are rejected, ignore-path filtering is supported, files are prefetched concurrently while reports remain ordered, and source-map warnings are emitted for applicable fixes.
Release metadata and user documentation
CHANGELOG.md, LICENSE.txt, package.json, README.md
The 1.3.0 release entry, MIT license, package metadata, and CLI/config/API documentation are updated.
Warning and terminology alignment
src/plugin.js, src/plugin.test.js, src/index.js
Savings-only warning text and related comments and assertions use “style sheet” terminology.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant FileSystem
  participant Analyzer
  User->>CLI: provide targets and options
  CLI->>FileSystem: prefetch target contents
  FileSystem-->>CLI: contents or read errors
  CLI->>Analyzer: process each target in order
  Analyzer-->>CLI: report and optional fixed CSS
  CLI-->>User: ordered reports and warnings
Loading

Possibly related PRs

  • j9t/css-dedup#1: Both changes extend normalization behavior in src/normalization.js.
  • j9t/css-dedup#3: Both modify aggressive normalization flow, including angle-related handling.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is too generic and does not describe the main changes, such as CLI options, normalization, and documentation updates. Rename it to reflect the primary change, e.g. "Add ignore-path support and normalization improvements".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/misc

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.

Update ignore path pattern matching to normalize paths to use `/` separators, ensuring consistent behavior across operating systems. This improves compatibility and prevents potential mismatches due to platform differences.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
Signed-off-by: Jens Oliver Meiert <jens@meiert.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@bin/css-dedup.js`:
- Around line 14-37: Replace the hardcoded LONG_OPTION_NAMES list with a shared
OPTIONS_CONFIG object containing the parseArgs option definitions, derive the
single-dash validation names from its keys, and pass OPTIONS_CONFIG to parseArgs
so the guard and parser remain synchronized.
- Around line 465-474: Update the file-discovery flow around ignorePathPatterns
and expandTargets so it distinguishes between no CSS files existing under the
positionals and all discovered CSS files being excluded by --ignore-path.
Preserve the existing error for targets with no CSS files, and report that files
were excluded when the ignore patterns remove every discovered file.

In `@bin/css-dedup.test.js`:
- Around line 1850-1953: Hoist the two regex literals used in the source-map
warning assertion and prefetch-ordering assertion to module scope to satisfy
e18e/prefer-static-regex. Define reusable module-level regex constants and
update the relevant tests, “Warns when `--fix` rewrites a file that references a
source map” and “Processes multiple files correctly when reads are prefetched
concurrently,” to use them without changing their matching behavior.

In `@src/normalization.js`:
- Around line 151-170: Hoist the zero-check regular expression used by
scaleDecimalExact to module scope as a shared constant, then update the
negative-zero condition in scaleDecimalExact to reuse that constant instead of
recreating the literal on each call. Leave the exact BigInt scaling logic
unchanged.
- Around line 211-286: Hoist the /^(min|max)\(/i pattern used by
sortMinMaxArguments into a module-level constant, then replace the inline regex
construction inside its scan loop with that constant while preserving the
existing boundary and matching behavior.

In `@src/plugin.test.js`:
- Line 50: Define the consolidation warning pattern as a module-scope regular
expression constant, then update the assertion in the relevant test to reuse
that constant instead of creating the regex inline.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: c3b2b3aa-291d-4aca-b02e-c3faf040f593

📥 Commits

Reviewing files that changed from the base of the PR and between bf6421f and 6adf1ed.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • CHANGELOG.md
  • LICENSE.txt
  • README.md
  • bin/css-dedup.js
  • bin/css-dedup.test.js
  • package.json
  • src/index.js
  • src/normalization.js
  • src/plugin.js
  • src/plugin.test.js

Comment thread bin/css-dedup.js Outdated
Comment thread bin/css-dedup.js
Comment thread bin/css-dedup.test.js
Comment thread src/normalization.js
Comment thread src/normalization.js
Comment thread src/plugin.test.js

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR bundles several CLI, normalization, docs, and release-related updates for css-dedup, including new path-based ignore support, improved equivalence detection (time/angle/min/max), and a 1.3.0 release with MIT licensing.

Changes:

  • Added --ignore-path / -p and ignorePaths config support to exclude files by relative path.
  • Improved duplicate detection by canonicalizing <time> (always), canonicalizing <angle> (aggressive-only), and sorting min()/max() arguments.
  • Updated CLI behavior (single-dash long option rejection, source map staleness warning, concurrent file prefetch) and updated docs/tests for the above plus release metadata (MIT + 1.3.0).

Reviewed changes

Copilot reviewed 5 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/plugin.test.js Updates expected warning text to match new “style sheet” wording.
src/plugin.js Updates savingsOnly withheld warning text (“style sheet”).
src/normalization.js Adds exact unit scaling for time/angle normalization and canonical min()/max() arg sorting.
src/index.js Comment-only wording updates (“style sheet”).
README.md Documents new flags/options and expanded behavior explanations (incl. ignore-path, unit equivalences, source map warning).
package.json Adds MIT license metadata and bumps version to 1.3.0.
package-lock.json Updates lock metadata for 1.3.0 and license.
LICENSE.txt Adds MIT license text.
CHANGELOG.md Adds 1.3.0 entry and minor text/typography tweaks.
bin/css-dedup.test.js Adds test coverage for new normalization and CLI behaviors; updates wording in existing tests.
bin/css-dedup.js Implements ignore-path filtering, rejects -fix-style typos, warns on stale source maps, and prefetches reads concurrently.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/normalization.js
Comment thread src/normalization.js
Refactor option definitions into a single shared configuration to avoid drift between long and short option handling. Update `expandTargets` to differentiate between no files found and all files excluded, improving error messaging clarity.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@j9t
j9t merged commit 1d93be0 into main Jul 12, 2026
8 checks passed
@j9t
j9t deleted the refactor/misc branch July 12, 2026 14:25
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