Skip to content

Commit

Permalink
Add Markdown linting to the Travis build by using the Rubygem mdl.
Browse files Browse the repository at this point in the history
Some basic markdown linkting removing trailing whitespace and excess blank lines and mods to headings.  Add config file to control which rules are run with basic setup of rules exlcuded for now.  Add Rubygem mdl as development dependency. Correct typo in CHANGELOG.
  • Loading branch information
jbampton authored and nunosilva800 committed Oct 13, 2019
1 parent f332298 commit 355f151
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 24 deletions.
2 changes: 2 additions & 0 deletions .mdlrc
@@ -0,0 +1,2 @@
git_recurse true
rules "~MD004,~MD006,~MD013,~MD014,~MD025,~MD029,~MD032,~MD033,~MD038"
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -26,4 +26,5 @@ script:
- bundle exec rake test - bundle exec rake test
- bundle exec cucumber features --format progress --color - bundle exec cucumber features --format progress --color
- bundle exec rake reek - bundle exec rake reek
- bundle exec mdl .
- bundle exec rubocop - bundle exec rubocop
5 changes: 2 additions & 3 deletions CHANGELOG.md
@@ -1,6 +1,6 @@
# master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.1.0...master) # master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.1.0...master)


* * [FEATURE] Add Markdown linting to the Travis build by using the Rubygem `markdownlint` (by [@jbampton][])


# master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.0.2...v4.1.0) # master [(unreleased)](https://github.com/whitesmith/rubycritic/compare/v4.0.2...v4.1.0)


Expand All @@ -15,7 +15,7 @@


# 4.0.1 / 2019-03-12 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.0.0...v4.0.1) # 4.0.1 / 2019-03-12 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.0.0...v4.0.1)


* [FEATUE] Allow passing formatters from the outside (by [@marcgrimme][] and [@onumis][]) * [FEATURE] Allow passing formatters from the outside (by [@marcgrimme][] and [@onumis][])
* [CHANGE] Fix aruba deprecation warning * [CHANGE] Fix aruba deprecation warning


# 4.0.0 / 2019-02-27 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.5.1...v4.0.0) # 4.0.0 / 2019-02-27 [(commits)](https://github.com/whitesmith/rubycritic/compare/v3.5.1...v4.0.0)
Expand Down Expand Up @@ -244,7 +244,6 @@


* Official Release * Official Release



[@LeeXGreen]: https://github.com/LeeXGreen [@LeeXGreen]: https://github.com/LeeXGreen
[@crackofdusk]: https://github.com/crackofdusk [@crackofdusk]: https://github.com/crackofdusk
[@halostatue]: https://github.com/halostatue [@halostatue]: https://github.com/halostatue
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Expand Up @@ -75,6 +75,7 @@ If you are experiencing unexpected behavior and, after having read the documenta


Changelog entry format Changelog entry format
------------------------ ------------------------

Here are a few examples: Here are a few examples:


``` ```
Expand Down
23 changes: 7 additions & 16 deletions README.md
@@ -1,15 +1,14 @@
RubyCritic # RubyCritic
==========


[![Gem Version](https://badge.fury.io/rb/rubycritic.svg)](http://badge.fury.io/rb/rubycritic) [![Gem Version](https://badge.fury.io/rb/rubycritic.svg)](http://badge.fury.io/rb/rubycritic)
[![Build Status](https://travis-ci.org/whitesmith/rubycritic.svg?branch=master)](https://travis-ci.org/whitesmith/rubycritic) [![Build Status](https://travis-ci.org/whitesmith/rubycritic.svg?branch=master)](https://travis-ci.org/whitesmith/rubycritic)
[![Code Climate](https://codeclimate.com/github/whitesmith/rubycritic/badges/gpa.svg)](https://codeclimate.com/github/whitesmith/rubycritic) [![Code Climate](https://codeclimate.com/github/whitesmith/rubycritic/badges/gpa.svg)](https://codeclimate.com/github/whitesmith/rubycritic)


<img src="https://github.com/whitesmith/rubycritic/raw/master/images/logo.png" alt="RubyCritic Icon" align="right" /> <img src="https://github.com/whitesmith/rubycritic/raw/master/images/logo.png" alt="RubyCritic Icon" align="right">


RubyCritic is a gem that wraps around static analysis gems such as [Reek][1], [Flay][2] and [Flog][3] to provide a quality report of your Ruby code. RubyCritic is a gem that wraps around static analysis gems such as [Reek][1], [Flay][2] and [Flog][3] to provide a quality report of your Ruby code.


**Table of Contents** ## Table of Contents


- [Overview](#overview) - [Overview](#overview)
- [Getting Started](#getting-started) - [Getting Started](#getting-started)
Expand All @@ -22,7 +21,6 @@ RubyCritic is a gem that wraps around static analysis gems such as [Reek][1], [F
- [Contributors](#contributors) - [Contributors](#contributors)
- [Credits](#credits) - [Credits](#credits)



## Overview ## Overview


This gem provides features such as: This gem provides features such as:
Expand Down Expand Up @@ -68,7 +66,6 @@ This gem provides features such as:


Checkout the `/docs` if you want to read more about our [core metrics](https://github.com/whitesmith/rubycritic/blob/master/docs/core-metrics.md). Checkout the `/docs` if you want to read more about our [core metrics](https://github.com/whitesmith/rubycritic/blob/master/docs/core-metrics.md).



## Getting Started ## Getting Started


RubyCritic can be installed with the following command: RubyCritic can be installed with the following command:
Expand All @@ -90,7 +87,6 @@ And then execute:
$ bundle $ bundle
``` ```



## Usage ## Usage


Running `rubycritic` with no arguments will analyse all the Ruby files in the Running `rubycritic` with no arguments will analyse all the Ruby files in the
Expand Down Expand Up @@ -138,6 +134,7 @@ $ rubycritic --help
You also can use a config file. Just create a `.rubycritic.yml` on your project root path. You also can use a config file. Just create a `.rubycritic.yml` on your project root path.


Here are one example: Here are one example:

```yml ```yml
mode_ci: mode_ci:
enabled: true # default is false enabled: true # default is false
Expand All @@ -162,18 +159,16 @@ paths: # Files to analyse.
project root and `RubyCritic` will respect this configuration. project root and `RubyCritic` will respect this configuration.
* [`flay`](https://github.com/seattlerb/flay): We use `flay`'s default configuration. * [`flay`](https://github.com/seattlerb/flay): We use `flay`'s default configuration.
* [`flog`](https://github.com/seattlerb/flog): We use `flog`'s default configuration with a couple of [smaller tweaks](https://github.com/whitesmith/rubycritic/blob/master/lib/rubycritic/analysers/helpers/flog.rb#L5): * [`flog`](https://github.com/seattlerb/flog): We use `flog`'s default configuration with a couple of [smaller tweaks](https://github.com/whitesmith/rubycritic/blob/master/lib/rubycritic/analysers/helpers/flog.rb#L5):
* `all`: Forces `flog` to report scores on all classes and methods. Without this option `flog` will only give results up to a certain threshold. * `all`: Forces `flog` to report scores on all classes and methods. Without this option `flog` will only give results up to a certain threshold.
* `continue`: Makes it so that `flog` does not abort when a ruby file cannot be parsed. * `continue`: Makes it so that `flog` does not abort when a ruby file cannot be parsed.
* `methods`: Configures `flog` to skip code outside of methods. It prevents `flog` from reporting on the "methods" `private` and `protected`. It also prevents `flog` from reporting on Rails methods like `before_action` and `has_many`. * `methods`: Configures `flog` to skip code outside of methods. It prevents `flog` from reporting on the "methods" `private` and `protected`. It also prevents `flog` from reporting on Rails methods like `before_action` and `has_many`.



### Alternative Usage Methods ### Alternative Usage Methods


If you're fond of Guard you might like [guard-rubycritic][4]. It automatically analyses your Ruby files as they are modified. If you're fond of Guard you might like [guard-rubycritic][4]. It automatically analyses your Ruby files as they are modified.


For continuous integration, you can give [Jenkins CI][5] a spin. With it, you can [easily build your own (poor-man's) Code Climate][6]! For continuous integration, you can give [Jenkins CI][5] a spin. With it, you can [easily build your own (poor-man's) Code Climate][6]!



### Rake Task ### Rake Task


You can use RubyCritic as Rake command in its most simple form like this: You can use RubyCritic as Rake command in its most simple form like this:
Expand Down Expand Up @@ -225,7 +220,6 @@ RubyCritic is supporting Ruby versions:
* 2.5 * 2.5
* 2.6 * 2.6



## Improving RubyCritic ## Improving RubyCritic


RubyCritic doesn't have to remain a second choice to other code quality analysis services. Together, we can improve it and continue to build on the great code metric tools that are available in the Ruby ecosystem. RubyCritic doesn't have to remain a second choice to other code quality analysis services. Together, we can improve it and continue to build on the great code metric tools that are available in the Ruby ecosystem.
Expand All @@ -236,10 +230,8 @@ Similarly, Pull Requests that improve the look and feel of the gem, that tweak t


See RubyCritic's [contributing guidelines](https://github.com/whitesmith/rubycritic/blob/master/CONTRIBUTING.md) about how to proceed. See RubyCritic's [contributing guidelines](https://github.com/whitesmith/rubycritic/blob/master/CONTRIBUTING.md) about how to proceed.



## Contributors ## Contributors



`RubyCritics` initial author was [Guilherme Simões](https://github.com/guilhermesimoes). `RubyCritics` initial author was [Guilherme Simões](https://github.com/guilhermesimoes).


The current core team consists of: The current core team consists of:
Expand All @@ -248,7 +240,6 @@ The current core team consists of:
* [Lucas Mazza](https://github.com/lucasmazza) * [Lucas Mazza](https://github.com/lucasmazza)
* [Timo Rößner](https://github.com/troessner) * [Timo Rößner](https://github.com/troessner)



## Credits ## Credits


![Whitesmith](https://github.com/whitesmith/rubycritic/raw/master/images/whitesmith.png) ![Whitesmith](https://github.com/whitesmith/rubycritic/raw/master/images/whitesmith.png)
Expand Down
4 changes: 2 additions & 2 deletions ROADMAP.md
Expand Up @@ -39,7 +39,7 @@ These are more nice-to-haves than promises. We can always dream. But this is wha


- [ ] [Brakeman](https://github.com/presidentbeef/brakeman) to provide security issues (Rails-only feature) - [ ] [Brakeman](https://github.com/presidentbeef/brakeman) to provide security issues (Rails-only feature)


- [ ] [Rails Best Practices](https://github.com/railsbp/rails_best_practices) to provide Rails smells (Rails-only feature) #14 - [ ] [Rails Best Practices](https://github.com/railsbp/rails_best_practices) to provide Rails smells (Rails-only feature) #14


- [ ] [SandiMeter](https://github.com/makaroni4/sandi_meter) #15 - [ ] [SandiMeter](https://github.com/makaroni4/sandi_meter) #15


Expand All @@ -53,4 +53,4 @@ These are more nice-to-haves than promises. We can always dream. But this is wha


![Code Climate Toggle Option](https://camo.githubusercontent.com/d97fc62dae6ebef1f35bda91942d4a6bacc445b2/687474703a2f2f626c6f672e636f6465636c696d6174652e636f6d2f696d616765732f706f7374732f74657374696e672e676966) ![Code Climate Toggle Option](https://camo.githubusercontent.com/d97fc62dae6ebef1f35bda91942d4a6bacc445b2/687474703a2f2f626c6f672e636f6465636c696d6174652e636f6d2f696d616765732f706f7374732f74657374696e672e676966)


Having an option to toggle between "Smells", "Security" (Brakeman) and "Style" (Rubocop) would be great. But that's already assuming we can integrate those gems into RubyCritic. Having an option to toggle between "Smells", "Security" (Brakeman) and "Style" (Rubocop) would be great. But that's already assuming we can integrate those gems into RubyCritic.
2 changes: 0 additions & 2 deletions docs/core-metrics.md
Expand Up @@ -46,7 +46,6 @@ Each file is represented by a dot. **The closer they are to the bottom-left corn
But keep in mind that you cannot reduce churn (well... not unless you re-write your repo's history :neckbeard:), so try to keep the dots as close to the bottom as possible. But keep in mind that you cannot reduce churn (well... not unless you re-write your repo's history :neckbeard:), so try to keep the dots as close to the bottom as possible.
Chad made a nice [summary if you want to know more][8] about the meaning behind each quadrant. Chad made a nice [summary if you want to know more][8] about the meaning behind each quadrant.



## Rating ## Rating


This is a letter from `A` to `F`, `A` being the best. This serves as a baseline to tell you how *smelly* a file is. This is a letter from `A` to `F`, `A` being the best. This serves as a baseline to tell you how *smelly* a file is.
Expand All @@ -61,7 +60,6 @@ Generally `A`'s & `B`'s are good enough, `C`'s serve as a warning and `D`'s & `F
The definition of this **cost** varies from tool to tool, but it's always a non-negative number, with high values indicating worse smells. The definition of this **cost** varies from tool to tool, but it's always a non-negative number, with high values indicating worse smells.
The **complexity** of a file also (slightly) affects its final cost. The **complexity** of a file also (slightly) affects its final cost.



[1]: https://gist.github.com/brynary/21369b5892525e1bd102 [1]: https://gist.github.com/brynary/21369b5892525e1bd102
[2]: https://github.com/troessner/reek [2]: https://github.com/troessner/reek
[3]: https://github.com/seattlerb/flay [3]: https://github.com/seattlerb/flay
Expand Down
1 change: 0 additions & 1 deletion docs/jenkins-pr-reviews.md
Expand Up @@ -15,7 +15,6 @@ For creating comments on PRs we are going to use the [Violation Comments to GitH
The Violation plugin has parsers for many different formats, and the GoLint one is compatible with the `lint` format created by RubyCritic. The Violation plugin has parsers for many different formats, and the GoLint one is compatible with the `lint` format created by RubyCritic.
We're assuming that you use a `Jenkinsfile` for creating a pipeline, but the approach can be adapted to other scenarios. We're assuming that you use a `Jenkinsfile` for creating a pipeline, but the approach can be adapted to other scenarios.



```groovy ```groovy
pipeline { pipeline {
agent any agent any
Expand Down
1 change: 1 addition & 0 deletions rubycritic.gemspec
Expand Up @@ -46,6 +46,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'cucumber', '~> 3.0', '>= 2.2.0' spec.add_development_dependency 'cucumber', '~> 3.0', '>= 2.2.0'
spec.add_development_dependency 'diff-lcs', '~> 1.3' spec.add_development_dependency 'diff-lcs', '~> 1.3'
spec.add_development_dependency 'fakefs', '~> 0.10', '>= 0.10.0' spec.add_development_dependency 'fakefs', '~> 0.10', '>= 0.10.0'
spec.add_development_dependency 'mdl', '~> 0.5.0'
spec.add_development_dependency 'minitest', '~> 5.3', '>= 5.3.0' spec.add_development_dependency 'minitest', '~> 5.3', '>= 5.3.0'
spec.add_development_dependency 'minitest-around', '~> 0.5.0', '>= 0.4.0' spec.add_development_dependency 'minitest-around', '~> 0.5.0', '>= 0.4.0'
spec.add_development_dependency 'mocha', '~> 1.1', '>= 1.1.0' spec.add_development_dependency 'mocha', '~> 1.1', '>= 1.1.0'
Expand Down

0 comments on commit 355f151

Please sign in to comment.