Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Rubocop plugins #8

Closed
artplan1 opened this issue Oct 7, 2019 · 1 comment
Closed

Rubocop plugins #8

artplan1 opened this issue Oct 7, 2019 · 1 comment

Comments

@artplan1
Copy link
Contributor

artplan1 commented Oct 7, 2019

I started to work on #6 but found some things in repo

Rubocop plugins

I see rubocop-rspec in dependencies, but it's not required in rubocop.yml, so it's not in use. Also rubocop-performance gem is missing (I can submit PR for this too)

Rubocop report with enabled plugins
be rubocop
Inspecting 27 files
.............C........CC...

Offenses:

lib/yavdb/sources/snyk_io.rb:69:54: C: Use match? instead of =~ when MatchData is not used.
                               .map { |link| link if link =~ %r{\/vuln\/.+} }.compact
                                                     ^^^^^^^^^^^^^^^^^^^^^^
spec/crawler_spec.rb:49:9: C: Example has too many lines [25/5].
        it "all #{package_manager} package vulnerabilities should have one type of version" do ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:22:1: C: Spec path should end with yavdb/sources/snyk_io/client*_spec.rb.
RSpec.describe YAVDB::Sources::SnykIO::Client do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:36:23: C: Use described_class instead of YAVDB::Sources::SnykIO::Client.
      advisory_page = YAVDB::Sources::SnykIO::Client.send(:get_page_html, test_url, false, nil)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:37:7: C: Use described_class instead of YAVDB::Sources::SnykIO::Client.
      YAVDB::Sources::SnykIO::Client.send(:create, test_url, advisory_page)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:40:5: C: Example has too many lines [12/5].
    it 'should have the required properties' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:40:5: C: Example has too many expectations [12/1].
    it 'should have the required properties' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:40:9: C: Do not use should when describing your tests.
    it 'should have the required properties' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:65:9: C: Do not use should when describing your tests.
    it 'should have valid properties' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:66:7: C: Prefer using be_all matcher over all?.
      expect(advisories.all? { |a| YAVDB::Constants::POSSIBLE_PACKAGE_MANAGERS.include?(a[:package_manager]) }).to be_truthy
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:69:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-JAVA-ORGJBPM-31602' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:69:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-JAVA-ORGJBPM-31602' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:69:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-JAVA-ORGJBPM-31602' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:70:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:maven:org.jbpm:jbpm-designer-client:31602' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:87:5: C: Example has too many lines [15/5].
    it 'should have correct properties for npm:xlsx:20180222' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:87:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for npm:xlsx:20180222' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:87:9: C: Do not use should when describing your tests.
    it 'should have correct properties for npm:xlsx:20180222' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:88:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:npm:xlsx:20180222' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:105:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-PYTHON-SWAUTH-40766' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:105:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-PYTHON-SWAUTH-40766' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:105:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-PYTHON-SWAUTH-40766' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:106:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:pypi:swauth:40766' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:123:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-RUBY-SORCERY-20425' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:123:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-RUBY-SORCERY-20425' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:123:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-RUBY-SORCERY-20425' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:124:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:rubygems:sorcery:20425' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:141:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMBTCSUITEGOSOCKSSOCKS-50055' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:141:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMBTCSUITEGOSOCKSSOCKS-50055' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:141:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMBTCSUITEGOSOCKSSOCKS-50055' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:142:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:go:github.com/btcsuite/go-socks/socks:50055' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:159:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMSNAPCORESNAPDDAEMON-50060' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:159:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMSNAPCORESNAPDDAEMON-50060' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:159:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-GOLANG-GITHUBCOMSNAPCORESNAPDDAEMON-50060' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:160:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:go:github.com/snapcore/snapd/daemon:50060' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:177:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-PHP-CONTAOLISTINGBUNDLE-70371' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:177:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-PHP-CONTAOLISTINGBUNDLE-70371' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:177:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-PHP-CONTAOLISTINGBUNDLE-70371' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:178:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:packagist:contao/listing-bundle:70371' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:195:5: C: Example has too many lines [15/5].
    it 'should have correct properties for SNYK-DOTNET-MIME-60187' do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:195:5: C: Example has too many expectations [14/1].
    it 'should have correct properties for SNYK-DOTNET-MIME-60187' do
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:195:9: C: Do not use should when describing your tests.
    it 'should have correct properties for SNYK-DOTNET-MIME-60187' do
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/snyk_io_spec.rb:196:25: C: Use find instead of select.first.
      vuln = advisories.select { |v| v.id == 'snykio:nuget:mime:60187' }.first
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

27 files inspected, 42 offenses detected
@rtfpessoa
Copy link
Owner

@artplan1 thanks for your report.
It is correct and this is something I would like to tackle it eventually.
In general I would like to keep a nice style in the code and catch most possible issues.

Feel free to send a PR with the improvements you noticed and also any extra plugins you find useful.

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

No branches or pull requests

2 participants