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

xcop.rb: Removes \n at the end of the corrected output #26

Closed
wants to merge 1 commit into from

Conversation

aashraybhandar1
Copy link

Fixes #25

Many thanks for your contribution, we truly appreciate it. We will appreciate it even more, if you make sure that you can say "YES" to each point in this short checklist:

  • You made a small amount of changes (less than 100 lines, less than 10 files)
  • You made changes related to only one bug (create separate PRs for separate problems)
  • You are ready to defend your changes (there will be a code review)
  • You don't touch what you don't understand
  • You ran the build locally and it passed

This article will help you understand what we are looking for: http://www.yegor256.com/2015/02/09/serious-code-reviewer.html

Thank you for your contribution!

@0crat
Copy link
Collaborator

0crat commented Apr 20, 2018

@yegor256/z please, pay attention to this pull request

@0crat
Copy link
Collaborator

0crat commented Apr 20, 2018

@aashraybhandar1/z this pull request is too small, just 4 lines changed (less than 10), there will be no formal code review; in the future, try to make sure your pull requests are not too small; @yegor256/z please review this and merge or reject

@codecov-io
Copy link

codecov-io commented Apr 21, 2018

Codecov Report

Merging #26 into master will increase coverage by 0.95%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
+ Coverage   90.62%   91.57%   +0.95%     
==========================================
  Files           3        3              
  Lines          96       95       -1     
==========================================
  Hits           87       87              
+ Misses          9        8       -1
Impacted Files Coverage Δ
lib/xcop.rb 87.5% <100%> (+1.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 67b5bed...e6b23fb. Read the comment docs.

@yegor256
Copy link
Owner

@rultor merge

@rultor
Copy link
Collaborator

rultor commented May 15, 2019

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented May 15, 2019

@rultor merge

@aashraybhandar1 @yegor256 Oops, I failed. You can see the full log here (spent 2min)


0% [14 Packages store 0 B] [9 InRelease gpgv 51.3 kB] [22 Packages 6113 B/6113 
0% [14 Packages store 0 B] [9 InRelease gpgv 51.3 kB] [Connecting to ppa.launch
                                                                               
92% [14 Packages store 1322 kB] [Waiting for headers]
                                                     
Get:23 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages [63.1 kB]

                                                     
93% [23 Packages 37.4 kB/63.1 kB 59%]
93% [Release.gpg gpgv 11.9 kB] [23 Packages 37.4 kB/63.1 kB 59%]
93% [21 Packages store 0 B] [Release.gpg gpgv 11.9 kB] [23 Packages 37.4 kB/63.
93% [Release.gpg gpgv 11.9 kB] [23 Packages 37.4 kB/63.1 kB 59%] [Waiting for h
93% [20 Packages store 0 B] [Release.gpg gpgv 11.9 kB] [23 Packages 37.4 kB/63.
95% [20 Packages store 0 B] [23 Packages 38.9 kB/63.1 kB 62%] [Waiting for head
                                                                               
95% [20 Packages store 0 B] [Waiting for headers]
                                                 
95% [Waiting for headers]
95% [22 Packages store 0 B] [Waiting for headers]
                                                 
96% [Waiting for headers]
96% [23 Packages store 0 B] [Waiting for headers]
                                                 
96% [Waiting for headers]
                         
Get:25 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 Packages [202 kB]

96% [25 Packages 7013 B/202 kB 3%]
                                  
100% [Working]
100% [25 Packages store 0 B]
                            
100% [Working]
              
Fetched 4345 kB in 1s (3700 kB/s)

Reading package lists... 0%

Reading package lists... 0%

Reading package lists... 1%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 69%

Reading package lists... 69%

Reading package lists... 70%

Reading package lists... 70%

Reading package lists... 71%

Reading package lists... 79%

Reading package lists... 79%

Reading package lists... 79%

Reading package lists... 79%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 93%

Reading package lists... 93%

Reading package lists... 93%

Reading package lists... 93%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 98%

Reading package lists... 98%

Reading package lists... Done

W: http://ppa.launchpad.net/natecarlson/maven3/ubuntu/dists/precise/Release.gpg: Signature by key 1F6F5A1396D75B0DB6FECE5AB70731143DD9F856 uses weak digest algorithm (SHA1)
+ sudo -i gem install pdd
Fetching pdd-0.20.5.gem
Fetching mini_portile2-2.4.0.gem
Fetching nokogiri-1.10.3.gem
Fetching rainbow-3.0.0.gem
Fetching slop-4.6.1.gem
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.3
Successfully installed rainbow-3.0.0
Successfully installed slop-4.6.1
Successfully installed pdd-0.20.5
Parsing documentation for mini_portile2-2.4.0
Installing ri documentation for mini_portile2-2.4.0
Parsing documentation for nokogiri-1.10.3
Installing ri documentation for nokogiri-1.10.3
Parsing documentation for rainbow-3.0.0
Installing ri documentation for rainbow-3.0.0
Parsing documentation for slop-4.6.1
Installing ri documentation for slop-4.6.1
Parsing documentation for pdd-0.20.5
Installing ri documentation for pdd-0.20.5
Done installing documentation for mini_portile2, nokogiri, rainbow, slop, pdd after 3 seconds
5 gems installed
+ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
\u001b[33mFollowing files may not be writable, so sudo is needed:
  /usr/local/rvm/gems/ruby-2.6.0
  /usr/local/rvm/gems/ruby-2.6.0/bin
  /usr/local/rvm/gems/ruby-2.6.0/bin
  /usr/local/rvm/gems/ruby-2.6.0/build_info
  /usr/local/rvm/gems/ruby-2.6.0/cache
  /usr/local/rvm/gems/ruby-2.6.0/doc
  /usr/local/rvm/gems/ruby-2.6.0/environment
  /usr/local/rvm/gems/ruby-2.6.0/extensions
  /usr/local/rvm/gems/ruby-2.6.0/gems
  /usr/local/rvm/gems/ruby-2.6.0/specifications
  /usr/local/rvm/gems/ruby-2.6.0/wrappers\u001b[0m
\u001b[32mFetching rake 12.0.0\u001b[0m
\u001b[32mInstalling rake 12.0.0\u001b[0m
\u001b[31mGem::FilePermissionError: You don't have write permissions for the
/usr/local/rvm/gems/ruby-2.6.0/wrappers directory.
\u001b[0m\u001b[0m\u001b[31mAn error occurred while installing rake (12.0.0), and Bundler
cannot continue.
Make sure that `gem install rake -v '12.0.0' --source 'https://rubygems.org/'`
succeeds before bundling.\u001b[0m

In Gemfile:
  rspec-rails was resolved to 3.1.0, which depends on
    railties was resolved to 5.2.3, which depends on
      rake\u001b[0m
container 6deadf976f0491543e379c9500a163c086fa37098c8237652a43419e6da8c785 is dead
Wed May 15 17:06:38 CEST 2019

@yegor256
Copy link
Owner

yegor256 commented Jul 3, 2019

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jul 3, 2019

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Jul 3, 2019

@rultor merge

@aashraybhandar1 @yegor256 Oops, I failed. You can see the full log here (spent 2min)


                                                    
98% [23 Packages 2556 B/3494 B 73%]
                                   
98% [Working]
98% [23 Packages store 0 B] [Connecting to ppa.launchpad.net (91.189.95.83)]
                                                                            
98% [Connecting to ppa.launchpad.net (91.189.95.83)]
                                                    
Get:24 http://ppa.launchpad.net/git-core/ppa/ubuntu xenial/main amd64 Packages [3522 B]

                                                    
98% [24 Packages 2688 B/3522 B 76%]
                                   
98% [Working]
98% [24 Packages store 0 B] [Connecting to ppa.launchpad.net (91.189.95.83)]
                                                                            
99% [Connecting to ppa.launchpad.net (91.189.95.83)]
                                                    
Get:25 http://ppa.launchpad.net/ondrej/php/ubuntu xenial/main amd64 Packages [63.1 kB]

                                                    
99% [25 Packages 1238 B/63.1 kB 2%]
                                   
100% [Working]
100% [25 Packages store 0 B]
                            
100% [Working]
              
Fetched 4495 kB in 1s (2474 kB/s)

Reading package lists... 0%

Reading package lists... 0%

Reading package lists... 1%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 10%

Reading package lists... 68%

Reading package lists... 68%

Reading package lists... 68%

Reading package lists... 69%

Reading package lists... 69%

Reading package lists... 78%

Reading package lists... 78%

Reading package lists... 79%

Reading package lists... 79%

Reading package lists... 85%

Reading package lists... 85%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 86%

Reading package lists... 92%

Reading package lists... 92%

Reading package lists... 93%

Reading package lists... 93%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 97%

Reading package lists... 98%

Reading package lists... 98%

Reading package lists... Done

W: http://ppa.launchpad.net/natecarlson/maven3/ubuntu/dists/precise/Release.gpg: Signature by key 1F6F5A1396D75B0DB6FECE5AB70731143DD9F856 uses weak digest algorithm (SHA1)
+ sudo -i gem install pdd -v 0.20.5
Fetching rainbow-3.0.0.gem
Fetching nokogiri-1.10.3.gem
Fetching mini_portile2-2.4.0.gem
Fetching pdd-0.20.5.gem
Fetching slop-4.6.1.gem
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
Successfully installed nokogiri-1.10.3
Successfully installed rainbow-3.0.0
Successfully installed slop-4.6.1
Successfully installed pdd-0.20.5
Parsing documentation for mini_portile2-2.4.0
Installing ri documentation for mini_portile2-2.4.0
Parsing documentation for nokogiri-1.10.3
Installing ri documentation for nokogiri-1.10.3
Parsing documentation for rainbow-3.0.0
Installing ri documentation for rainbow-3.0.0
Parsing documentation for slop-4.6.1
Installing ri documentation for slop-4.6.1
Parsing documentation for pdd-0.20.5
Installing ri documentation for pdd-0.20.5
Done installing documentation for mini_portile2, nokogiri, rainbow, slop, pdd after 3 seconds
5 gems installed
+ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
\u001b[33mFollowing files may not be writable, so sudo is needed:
  /usr/local/rvm/gems/ruby-2.6.0
  /usr/local/rvm/gems/ruby-2.6.0/bin
  /usr/local/rvm/gems/ruby-2.6.0/bin
  /usr/local/rvm/gems/ruby-2.6.0/build_info
  /usr/local/rvm/gems/ruby-2.6.0/cache
  /usr/local/rvm/gems/ruby-2.6.0/doc
  /usr/local/rvm/gems/ruby-2.6.0/environment
  /usr/local/rvm/gems/ruby-2.6.0/extensions
  /usr/local/rvm/gems/ruby-2.6.0/gems
  /usr/local/rvm/gems/ruby-2.6.0/specifications
  /usr/local/rvm/gems/ruby-2.6.0/wrappers\u001b[0m
\u001b[32mFetching rake 12.0.0\u001b[0m
\u001b[32mInstalling rake 12.0.0\u001b[0m
\u001b[31mGem::FilePermissionError: You don't have write permissions for the
/usr/local/rvm/gems/ruby-2.6.0/wrappers directory.
\u001b[0m\u001b[0m\u001b[31mAn error occurred while installing rake (12.0.0), and Bundler
cannot continue.
Make sure that `gem install rake -v '12.0.0' --source 'https://rubygems.org/'`
succeeds before bundling.\u001b[0m

In Gemfile:
  rspec-rails was resolved to 3.1.0, which depends on
    railties was resolved to 5.2.3, which depends on
      rake\u001b[0m
container 1e7794e1ebd8af629b15cdf07de2a79614951b92fe35ef85db46c12d0873ae51 is dead
Wed Jul  3 14:56:37 CEST 2019

yegor256 added a commit that referenced this pull request Jul 3, 2019
@yegor256
Copy link
Owner

yegor256 commented Jul 3, 2019

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jul 3, 2019

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Collaborator

rultor commented Jul 3, 2019

@rultor merge

@aashraybhandar1 @yegor256 Oops, I failed. You can see the full log here (spent 3min)

\u001b[32m      if spec.executables.empty?\u001b[0m
\u001b[32m        fail 'no executables: ' + File.read('./spec.rb')\u001b[0m
\u001b[32m      end\u001b[0m
\u001b[32m      """\u001b[0m
/tmp/test20190703-12904-csvhut/xcop/lib/xcop/version.rb:26: warning: already initialized constant Xcop::VERSION
/home/r/repo/lib/xcop/version.rb:26: warning: previous definition of VERSION was here
    \u001b[32mWhen I run bash with:\u001b[90m                        # features/step_definitions/steps.rb:80\u001b[0m\u001b[0m
\u001b[32m      """\u001b[0m
\u001b[32m      cd xcop\u001b[0m
\u001b[32m      gem build xcop.gemspec\u001b[0m
\u001b[32m      gem specification --ruby xcop-*.gem > ../spec.rb\u001b[0m
\u001b[32m      cd ..\u001b[0m
\u001b[32m      ruby execs.rb\u001b[0m
\u001b[32m      """\u001b[0m
    \u001b[32mThen Exit code is zero\u001b[90m                       # features/step_definitions/steps.rb:66\u001b[0m\u001b[0m

Feature: Rake tasks
  As a source code writer I want to be able to
  run Xcop from Rakefile

  Scenario: Xcop can be used in Rakefile\u001b[90m       # features/rake.feature:5\u001b[0m
    \u001b[32mGiven It is Unix\u001b[90m                           # features/step_definitions/steps.rb:86\u001b[0m\u001b[0m
    \u001b[32mAnd I have a "\u001b[32m\u001b[1mRakefile\u001b[0m\u001b[0m\u001b[32m" file with content:\u001b[90m # features/step_definitions/steps.rb:43\u001b[0m\u001b[0m
\u001b[32m      """\u001b[0m
\u001b[32m      require 'xcop/rake_task'\u001b[0m
\u001b[32m      Xcop::RakeTask.new(:xcop) do |task|\u001b[0m
\u001b[32m        task.includes = ['good.xml']\u001b[0m
\u001b[32m      end\u001b[0m
\u001b[32m      """\u001b[0m
    \u001b[32mAnd I have a "\u001b[32m\u001b[1mgood.xml\u001b[0m\u001b[0m\u001b[32m" file with content:\u001b[90m # features/step_definitions/steps.rb:43\u001b[0m\u001b[0m
\u001b[32m      """\u001b[0m
\u001b[32m      <?xml version="1.0"?>\u001b[0m
\u001b[32m      <hello>Hello, world!</hello>\u001b[0m
\u001b[32m\u001b[0m
\u001b[32m      """\u001b[0m
    \u001b[32mWhen I run bash with "\u001b[32m\u001b[1mrake xcop\u001b[0m\u001b[0m\u001b[32m"\u001b[90m           # features/step_definitions/steps.rb:74\u001b[0m\u001b[0m
    \u001b[32mThen Exit code is zero\u001b[90m                     # features/step_definitions/steps.rb:66\u001b[0m\u001b[0m

9 scenarios (\u001b[32m9 passed\u001b[0m)
36 steps (\u001b[32m36 passed\u001b[0m)
0m3.479s
Coverage report generated for Cucumber Features, Unit Tests to /home/r/repo/coverage. 84 / 92 LOC (91.3%) covered.
Running RuboCop...
.rubocop.yml: Style/MultilineMethodCallIndentation has the wrong namespace - should be Layout
Inspecting 11 files
\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[33mC\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m\u001b[32m.\u001b[0m

Offenses:

\u001b[36mlib/xcop.rb\u001b[0m:109:7: \u001b[33mC\u001b[0m: Style/IfUnlessModifier: Favor modifier \u001b[33munless\u001b[0m usage when having a single-line body. Another good alternative is the usage of control flow \u001b[33m&&\u001b[0m/\u001b[33m||\u001b[0m.
      unless nocolor
      ^^^^^^
\u001b[36mlib/xcop.rb\u001b[0m:116:12: \u001b[33mC\u001b[0m: Performance/StringReplacement: Use \u001b[33mtr\u001b[0m instead of \u001b[33mgsub\u001b[0m.
      text.gsub(/\n/, "\n")
           ^^^^^^^^^^^^^^^^

11 files inspected, \u001b[31m2 offenses\u001b[0m detected
RuboCop failed!
container ae4eee566236d4c763f63aa2bad56b073dba946e88fefae3b12259414d343bf0 is dead
Wed Jul  3 15:03:29 CEST 2019

@yegor256
Copy link
Owner

yegor256 commented Jul 3, 2019

@aashraybhandar1 it seems that your code is not clean enough. Run bundle exec rake to check where are the problems.

@yegor256
Copy link
Owner

@aashraybhandar1 I'm closing this one, since it's too old and not mergeable. Would be great if you create a new one.

@yegor256 yegor256 closed this Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra \n added in schars function
5 participants