Giter Site home page Giter Site logo

codelint's Introduction

Lint code in repository

Code Linting & Formatting Showcase

Try linting example.py with pylint, pylama and reformat it with black.

pip install pylint pylama black
pylint example.py
pylama example.py
black --check --diff example.py

For YAML, first lint playbook.yml with yamllint.

yamllint playbook.yml
playbook.yml
  1:1       error    too many blank lines (1 > 0)  (empty-lines)
  2:3       warning  comment not indented like content  (comments-indentation)
  3:1       warning  missing document start "---"  (document-start)
  3:81      error    line too long (101 > 80 characters)  (line-length)
  8:20      error    too many spaces before colon  (colons)
  13:7      error    duplication of key "ios" in mapping  (key-duplicates)

Now, fix the duplicate key error on line 13 in playbook.yml and run ansible-lint. Note the custom rule (in the custom_rules folder) that checks whether task names are written in all uppercase.

ansible-lint -Rr custom_rules playbook.yml
[289] All task names should be capitalized
playbook.yml:19
Task/Handler: Task 1 - ensure snmp commands exist on ios and vmx devices

[502] All tasks should be named
playbook.yml:23
Task/Handler: cli_config msg=A task without a name, so lazy! __line__=23 __file__=playbook.yml

codelint's People

Contributors

cmsirbu avatar

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.