Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rake task to detect trailing whitespace in markdown files #151

Closed
bastelfreak opened this issue May 8, 2016 · 8 comments
Closed

Add rake task to detect trailing whitespace in markdown files #151

bastelfreak opened this issue May 8, 2016 · 8 comments

Comments

@bastelfreak
Copy link
Member

IMO it is best practice to avoid trailing whitespace. I'm not sure if any of our tasks already can handle this or if there are existing solutions. Any opinions?

@bastelfreak
Copy link
Member Author

maybe we also want to think a step further and offer something to automatically remove the whitespaces?

@jyaworski
Copy link
Member

@bastelfreak isn't this checked for by puppet-lint and rubocop both?

@bastelfreak
Copy link
Member Author

Our existing rake tasks seem to ignore it. I never get complaints when I run them local, just my vim does.

@dhoppe
Copy link
Member

dhoppe commented Sep 17, 2016

Our current setup already does that.

Puppet lint

dhoppe@macbook ~/Projects/puppet/puppet-kafka (git)-[master] % git diff
diff --git a/manifests/init.pp b/manifests/init.pp
index 33edd6a..e3389d5 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -47,7 +47,7 @@
 #
 #
 class kafka (
-  $version        = $kafka::params::version,
+  $version        = $kafka::params::version,
   $scala_version  = $kafka::params::scala_version,
   $install_dir    = $kafka::params::install_dir,
   $mirror_url     = $kafka::params::mirror_url,
dhoppe@macbook ~/Projects/puppet/puppet-kafka (git)-[master] % bundle exec rake test
manifests/init.pp:50:trailing_whitespace:ERROR:trailing whitespace found
bundle exec rake test  4.78s user 0.27s system 99% cpu 5.077 total

Rubocop

dhoppe@macbook ~/Projects/puppet/puppet-kafka (git)-[master] % git diff
diff --git a/spec/classes/broker_spec.rb b/spec/classes/broker_spec.rb
index a1c4e7b..ef588ef 100644
--- a/spec/classes/broker_spec.rb
+++ b/spec/classes/broker_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
 describe 'kafka::broker', type: :class do
   let :facts do
     {
-      osfamily: 'Debian',
+      osfamily: 'Debian',
       operatingsystem: 'Ubuntu',
       operatingsystemrelease: '14.04',
       lsbdistcodename: 'trusty',
dhoppe@macbook ~/Projects/puppet/puppet-kafka (git)-[master] % rubocop .
Inspecting 15 files
.....C.........

Offenses:

spec/classes/broker_spec.rb:6:26: C: Trailing whitespace detected.
      osfamily: 'Debian',
                         ^

15 files inspected, 1 offense detected

We could use something like puppet-lint -f manifests/ and rubocop -a . as Git hooks, but I am not sure if this is always a good idea.

@ghoneycutt
Copy link
Member

@bastelfreak puppet-lint is already doing this for us. Closing as this issue is quite old and seems to be resolved. Please re-open if I'm missing something.

@bastelfreak
Copy link
Member Author

Personally, I would also like to see our markdown files without trailing whitespace. This is currently not implemented.

@bastelfreak bastelfreak reopened this Jan 2, 2019
@ghoneycutt ghoneycutt changed the title Add rake task to detect trailing whitespace Add rake task to detect trailing whitespace in markdown files Jan 2, 2019
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 2, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
@ghoneycutt
Copy link
Member

@bastelfreak opened a PR to fix this at #532

ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 3, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 3, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 3, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 3, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 5, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 5, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 6, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 8, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.

Disable rubocop cop's in Rakefile that are not actually improving code

Enabling these cops, with regards to the trailing_whitespace task, make
the code more difficult to read and understand. The ability to
understand the code easily should take precedence over any style.
ghoneycutt added a commit to ghoneycutt/modulesync_config that referenced this issue Jan 8, 2019
This PR can easily be changed to add other files that should be checked
for trailing whitespace.

Disable rubocop cop's in Rakefile that are not actually improving code

Enabling these cops, with regards to the trailing_whitespace task, make
the code more difficult to read and understand. The ability to
understand the code easily should take precedence over any style.
ekohl added a commit to ekohl/modulesync_config that referenced this issue Jan 10, 2019
This implements a rake task check:trailing_whitespace. The actual check
has mostly been written by Garrett Honeycutt.

Co-authored-by: Garrett Honeycutt <code@garretthoneycutt.com>
ekohl added a commit to ekohl/modulesync_config that referenced this issue Jan 11, 2019
This implements a rake task check:trailing_whitespace. The actual check
has mostly been written by Garrett Honeycutt.

Co-authored-by: Garrett Honeycutt <code@garretthoneycutt.com>
ghoneycutt added a commit that referenced this issue Jan 11, 2019
(GH-151) Implement whitespace checks for markdown
@dhoppe
Copy link
Member

dhoppe commented Dec 6, 2019

@bastelfreak I think this issue can be closed since it has been solved via #541.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants