plone / plone.recipe.codeanalysis

provides static code analysis for Buildout-based Python projects, including flake8, JSHint, CSS Lint, and other code checks
https://pypi.org/project/plone.recipe.codeanalysis/
11 stars 8 forks source link

Error to ignore folder with css #197

Closed idgserpro closed 7 years ago

idgserpro commented 7 years ago

If I have a product with the structure:

my.product/src/my/product/folder1/withproblem.css
my.product/src/my/product/folder1/folder12/withproblem2.css
my.product/src/my/product/folder2/withproblem3.css

and .csslintrc ignore folder12 and folder2:

--format=compact
--quiet
--exclude-list=src/my/product/folder1/folder12, src/my/product/folder2

So codeanalysis does not indicate error in file my.product/src/my/product/folder1/withproblem.css but should indicate.

gforcada commented 7 years ago

@idgserpro is p.r.codeanalysis using that configuration file anyway? If you change the exclude-list the other files are also checked?

idgserpro commented 7 years ago

@gforcada yes, codeanalysis is using .csslintrc. But my example of .csslintrc was wrong. Fix in description of issue.

When I use .csslintrc as is the description of the issue, it does not indicate any error.

When I use:

--format=compact
--quiet

It indicates error in the three files.

idgserpro commented 7 years ago

Ops, the way it was, he should not indicate error really. I'll check here.

idgserpro commented 7 years ago

.csslintrc of description changed again.

What happens is that some warnings are only showing if an error occurs in a CSS file. In my example when:

withproblem.css, withproblem2.css and withproblem3.css are:

#test {
    width: 100%;
}

no error is indicated.

But if withproblem.css and withproblem3.css are:

#test {
    width: 100%;
}

and withproblem2.css:

#test {
    width: 100%;

So:

CSS Lint........................[ FAILURE ] in 0.253s
/home/user/my.product/src/my/product/folder1/withproblem.css: line 1, col 1, Warning - Don't use IDs in selectors. (ids)

/home/user/my.product/src/my/product/folder1/folder12/withproblem2.css: line 1, col 1, Warning - Don't use IDs in selectors. (ids)
/home/user/my.product/src/my/product/folder1/folder12/withproblem2.css: line 3, col 1, Error - Expected RBRACE at line 3, col 1. (errors)
/home/user/my.product/src/my/product/folder1/folder12/withproblem2.css: line 3, col 1, Error - Expected RBRACE at line 3, col 1. (errors)

Warning of withproblem.css that were not shown before are now shown. And errors of withproblem2.css that should be ignored are shown.

idgserpro commented 7 years ago

@gforcada can you confirm that? This seems to me a serious bug.

gforcada commented 7 years ago

@idgserpro I remember seeing that behavior as well, but that should be reported upstream to csslint

idgserpro commented 7 years ago

@gforcada I tested here again and it seems that the problem of not ignoring files has been solved by the new version of csslint installed by the node.

However, the situation of plone.recipe.codeanalysis shows csslint warnings only when an error occurs in a file, still occurs. I think the warnings should be displayed even if a csslint error doesn't occur.

gforcada commented 7 years ago

@idgserpro then this is probably when you want to make your changes: https://github.com/plone/plone.recipe.codeanalysis/blob/master/plone/recipe/codeanalysis/csslint.py#L30-L42

idgserpro commented 7 years ago

@gforcada thank you!

As the problem of ignoring files has been solved by the csslint version, I will close the issue.

I'll open another issue about the warning.