Giter Site home page Giter Site logo

codeqa's Introduction

Codeqa

Gem Version Build Status Coverage Status Code Climate

With codeqa you can check your code to comply to certain coding rules (utf8 only chars, indenting) or to avoid typical errors or enforce deprecations. You might even put it into a pre commit hook.

Installation

Add this line to your application's Gemfile:

gem 'codeqa'

And then execute:

$ bundle

Or install it yourself as:

$ gem install codeqa

Usage

codeqa filename

Config

Since Version 0.3 codeqa uses ruby for configuration, therefore the config file is now named .codeqa.rb. The loading of configuration files is still the same, meaning we have to following load order:

  1. Initialize with default settings (see config/default.rb)
  2. load .codeqa/config.rb from your home directory and merge it with the defaults.
  3. load .codeqa/config.rb placed in the project root, which is determined by finding the closest .git folder.

Both the config in your home directory and the project config file are optional and will be automatically skiped if they do not exist.

Because codeqa now uses ruby for configuration we can more easily change settings without replacing it completely.

Example Config

Codeqa.configure do |config|
  # override the list of excludes
  config.excludes = ['coverage/*',
                     'pkg/*',
                     'tmp/*',
                     /\.log/]

  # remove the default ruby lint in favor of rubocop
  config.enabled_checker.delete 'CheckRubySyntax'
  config.enabled_checker << 'RubocopLint'
  # also enable the rubocop autoformatter
  config.enabled_checker << 'RubocopFormatter'

  # add some more active formatters/cops to rubocop
  config.rubocop_formatter_cops << 'AlignHash'
  config.rubocop_formatter_cops << 'SignalException'
  config.rubocop_formatter_cops << 'DeprecatedClassMethods'
  config.rubocop_formatter_cops << 'RedundantBegin'
  config.rubocop_formatter_cops << 'RedundantSelf'
  config.rubocop_formatter_cops << 'RedundantReturn'
  config.rubocop_formatter_cops << 'CollectionMethods'
end

Checkers

  • pattern
    • CheckPry
    • CheckRspecFocus
    • CheckConflict
    • CheckStrangeChars
    • CheckLinkTo
  • rubocop
    • RubocopLint (replacement for CheckRubySyntax)
    • RubocopFormatter
  • erb
    • CheckErb (tests erb template for syntax errors using either erb or action_view
    • CheckErbHtml (removes all erb tags and tests with tidy if the template is valid XML)
    • HtmlValidator (uses Nokogiri to check stripped html.erb files against XML errors)
  • yard
    • CheckYard (checks YARD for warnings)
  • CheckRubySyntax (runs file though ruby -c, use RubocopLint if possible)

Hooks

Since version 0.5 it's possible to run any scripts which are placed at .codeqa/hooks . If they exit with code <> 0 the commit is not allowed. The scripts have to be executable.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

codeqa's People

Contributors

andreaseger avatar

Watchers

Peter Schrammel avatar James Cloos avatar  avatar Robert Schmidtke 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.