Giter Site home page Giter Site logo

codeclimate-csslint's Introduction

Code Climate CSSLint Engine

Code Climate

codeclimate-csslint is a Code Climate engine that wraps CSSLint. You can run it on your command line using the Code Climate CLI, or on our hosted analysis platform.

CSSLint helps point out problems with your CSS code. It does basic syntax checking as well as applying a set of rules that look for problematic patterns or signs of inefficiency. Each rule is pluggable, so you can easily write your own or omit ones you don't want.

Installation

  1. If you haven't already, install the Code Climate CLI.
  2. Run codeclimate engines:enable csslint. This command both installs the engine and enables it in your .codeclimate.yml file.
  3. You're ready to analyze! Browse into your project's folder and run codeclimate analyze.

Need help?

For help with CSSLint, check out their documentation.

If you're running into a Code Climate issue, first look over this project's GitHub Issues, as your question may have already been covered. If not, go ahead and open a support ticket with us.

codeclimate-csslint's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeclimate-csslint's Issues

Nokogiri error in engine

When I try to run codeclimate-csslint on a large codebase, I get the following error:

$ codeclimate analyze -e csslint
Starting analysis
Running csslint: Done!
error: (CC::Analyzer::Engine::EngineFailure) engine csslint failed with status 1 and stderr 
WARNING: Nokogiri was built against LibXML version 2.9.2, but has dynamically loaded 2.9.3
/usr/src/app/lib/cc/engine/csslint.rb:23:in `block (3 levels) in run': undefined method `value' for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
    from /usr/src/app/lib/cc/engine/csslint.rb:19:in `block (2 levels) in run'
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
    from /usr/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2/lib/nokogiri/xml/node_set.rb:186:in `each'
    from /usr/src/app/lib/cc/engine/csslint.rb:17:in `block in run'
    from /usr/src/app/lib/cc/engine/csslint.rb:16:in `chdir'
    from /usr/src/app/lib/cc/engine/csslint.rb:16:in `run'
    from /usr/src/app/bin/csslint:14:in `<main>'

When I run it in a small codebase it runs successfully. Any clues about what might be going on?

Strange alphabetical sorting rules

In this file the engine says Rule doesn't have all its properties in alphabetical ordered. regarding this chunk of css:

40% {
    -webkit-transform: matrix(1, 0, 0, 1, 0,-1);
    opacity: 1;
    transform: matrix(1, 0, 0, 1, 0,-1);
}

But css-rules in that chunk are properly alphabetical ordered. I guess the engine ignores initial hyphen in -webkit-transform rule and tries to compare webkit-transform with transform? But prefixed css-rules should always be before the same non-prefixed.

So, is it a bug?

csslint attempts to lint files that are not .css files

== node_modules/babel-eslint/node_modules/babel-core/node_modules/convert-source-map/test/fixtures/map-file-comment-inline.css (680 issues) ==
1: Unexpected token '-' at line 1, col 1. [csslint]
1: Unexpected token '#' at line 1, col 1. [csslint]
...
== package.json (680 issues) ==
1: Unexpected token '-' at line 1, col 1. [csslint]
1: Unexpected token '#' at line 1, col 1. [csslint]
...
Analysis complete! Found 8,160 issues.

csslint is very, very eager to lint my files. A little... too eager. This output was generated by https://github.com/deltamualpha/metalsmith-collection-tags (after switching csslint to enabled: true). It's also ignoring exclude_paths (as mentioned in #13).

Exclude not working

For some reason, the csslint is reporting things in vendor (for example, I have scss gem) even though vendor is part of the exclude_paths in the codeclimate config.

I'm still looking into why that is. Let me know if you would like me to set an example repo to test this!

Push updated image to dockerhub

The root cause of #13 and #14 (when running in the codeclimate cli) is that the current image on dockerhub is based on 735a1ef
The fixes for these issues are a couple of commits later, in 6187fb6

Pushing the latest image so it's available for the cli should fix this.

Codeclimate tries to lint comments?

Source is here: https://github.com/frank-borkin/ga-pg/blob/master/www/css/index.css
csslint.net (standard options) show no errors, 26 warnings.
Codeclimate shows 5080 issues. (available here: https://codeclimate.com/github/frank-borkin/ga-pg/www/css/index.css - opening this page has another issue, I'll open a seperate bug)
It also shows a churn of 500+ even those this is the only revision of the file.

The first set of errors appear to be where the linter evaluates the contents of comments - it shouldn't.

Running ccslint on codeclimate CLI crashes oddly

It is being impossible to me running csslint with codeclimate.

setup

This is my local setup

  • Mac OS X 10.10.3 (Yosemite)
  • boot2docker 1.7.0
  • codeclimate CLI 0.0.8 (installed the brew package)
  • bash 4.3 (this is not important it worked exactly the same with 3.2 but I had to upgrade it by other reasons)

codeclimate config

This is my .codeclimate.yml file


---
engines:
  phpcodesniffer:
    enabled: false
  coffeelint:
    enabled: false
  eslint:
    enabled: true
  csslint:
    enabled: false
ratings:
  paths:
  - "**.php"
  - "**.js"
  - "**.css"
exclude_paths:
- "node_modules/**/*"
- "vendor/**/*"
- "etc/**/*"
- ".vagrant/**/*"

I run composer analyze and this is the result:

 codeclimate analyze
Starting analysis
Running csslint: \Error deleting container: Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
An error occurred trying to connect: Post https://192.168.59.103:2376/v1.19/containers/acbef0423c3c1cdd9aaa07fe2de1d47b3f052eb8991e0a443e07b8dfa95944bb/wait: EOF

After that the only possible solution is boot2docker restart. Other engines (phpcodesniffer) works. Any help?

.csslintrc not working when it's in a directory

ESLint allows a custom location for the config file:

  eslint:
    enabled: true
    config:
      config: FOLDER/.eslintrc

It seems CSSLint doesn't support this:

  csslint:
    enabled: true
    config:
      config: FOLDER/.csslintrc

It only works when the .csslintrc is in the root directory.
Do I need to change it or is it just not supported?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.