sonar-css-plugin icon indicating copy to clipboard operation
sonar-css-plugin copied to clipboard

Problem with rule unknown-less-functions

Open szegi opened this issue 6 years ago • 5 comments

I started using this plugin and i see that it found an issue with "extend" function

.maine-layout--selected:extend(.maine-layout) {
    color: @text-color-grey;
    .status-new, .status-old, .status-ignore {
        color: @text-color-grey;
    }
}

but it doesnt see problem with

.client-library__some-data {
    &:extend(.client-list__some-data);
}

from what i read, extend is less function from some time http://lesscss.org/features/#extend-feature

szegi avatar Mar 27 '18 14:03 szegi

Hi,

Which version of the plugin are you running?

David

racodond avatar Mar 27 '18 15:03 racodond

right now version 4.14

szegi avatar Mar 28 '18 07:03 szegi

Hi,

I cannot reproduce the issue. Could you please provide the entire file as well a screenshot of the issue?

Thank you

David

racodond avatar Apr 01 '18 19:04 racodond

Hello @racodond, I wrote a code which allows to reproduce the error:

unknown-less-functions

The file is compiled successfully.

Environment:

  • CSS / SCSS / Less plugin: 4.15
  • SonarQube: 7.0

Example file: https://github.com/agabrys/sonarqube-falsepositives/blob/master/src/main/less/d20180410/unknown-less-functions.less

Project: https://github.com/agabrys/sonarqube-falsepositives

Build: mvn clean package sonar

Best Regards

agabrys avatar Apr 10 '18 18:04 agabrys

Thanks for the reproducer @agabrys!

It's a tricky bug related to at-rule parsing. The violation here is a side-effect from that parsing issue. keyword: @media prelude:

(max-width: 768px) {
    .navtab-info--dates {
        padding-left: 1%;
    }
}

.customization-form__variation-data, .customization-form__variation-menu {
    display: inline-block;
}

.client-library__some-data {
    &:extend(.client-list__some-data);
}

.variation-layout--selected:extend(.variation-layout) {
    color: #000;
    .status-active, .status-inactive, .status-ignore {
        color: #000;
    }
}

block: none

instead of

keyword: @media prelude: (max-width: 768px) block:

{
    .navtab-info--dates {
        padding-left: 1%;
    }
}

.customization-form__variation-data, .customization-form__variation-menu {
    display: inline-block;
}

.client-library__some-data {
    &:extend(.client-list__some-data);
}

.variation-layout--selected:extend(.variation-layout) {
    color: #000;
    .status-active, .status-inactive, .status-ignore {
        color: #000;
    }
}

racodond avatar Apr 13 '18 14:04 racodond