[CSS] RSPEC-125: Sections of code should not be commented out

Implementations of RSPEC-125 “Sections of code should not be commented out” already exists for a lot of languages.

But there does not seem to be an implementation for CSS yet.

The type, severity and tags should be the same as for the other languages, e.g. Java static code analysis: Sections of code should not be commented out

Or was it intentionally omitted due to concern over false-positives in CSS?
I figured that the basic heuristic of checking for the present of semicolons in the comment would also work in CSS to distinguish commented-out code from regular comments.

/* Material progress card */     <-- COMPLIANT
.mat-progress-card {
  // --left : 1.29rem;                <-- NONCOMPLIANT
  // --right : 1.57rem;               <-- NONCOMPLIANT
  display: flex;
  position: relative;
  // width: calc(100vw - var(--left) - var(--right));       <-- NONCOMPLIANT
  height: 6.07143rem;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;

  // No margin at the bottom              <-- COMPLIANT
  margin: 20px 20px 0 20px; // changes    <-- COMPLIANT
}
2 Likes

Hi @CrushaKRool,

thanks for the feedback, indeed we agree it makes sense. I’ve added a ticket to add this rule for CSS.

Cheers,
Victor

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.