pivotal / LicenseFinder

Find licenses for your project's dependencies.
MIT License
1.73k stars 340 forks source link

Ruby Warnings #1036

Closed amatsuda closed 6 months ago

amatsuda commented 7 months ago

This patch fixes three kinds of Ruby warnings that we see when requiring this gem.

$  ruby -rlicense_finder -wep                                                                                                                                           ~/s/g/p/LicenseFinder (master|✔)
<internal:.../rubygems/core_ext/kernel_require.rb>:136: warning: <internal:.../rubygems/core_ext/kernel_require.rb>:136: warning: loading in progress, circular require considered harmful - .../license_finder-7.1.0/lib/license_finder/packages/go_package.rb
    from <internal:.../rubygems/core_ext/kernel_require.rb>:135:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:141:in  'rescue in require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:141:in  'require'
    from .../license_finder-7.1.0/lib/license_finder.rb:13:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from .../license_finder-7.1.0/lib/license_finder/core.rb:9:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from .../license_finder-7.1.0/lib/license_finder/package_manager.rb:157:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from .../license_finder-7.1.0/lib/license_finder/package_managers/go_modules.rb:3:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from .../license_finder-7.1.0/lib/license_finder/packages/go_package.rb:3:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from .../license_finder-7.1.0/lib/license_finder/package.rb:174:in  '<top (required)>'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'
    from <internal:.../rubygems/core_ext/kernel_require.rb>:136:in  'require'

.../license_finder-7.1.0/lib/license_finder/packages/npm_package.rb:97: warning: ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after '/' operator
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb:99: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb:100: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb:178: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/yarn.rb: warning: character class has duplicated range
.../license_finder-7.1.0/lib/license_finder/package_managers/rebar.rb:44: warning: character class has duplicated range: /(?<name>\w+)─(?<version>[\S.]+)\s*/
.../license_finder-7.1.0/lib/license_finder/package_managers/rebar.rb: warning: character class has duplicated range: /(?<name>\w+)─(?<version>[\S.]+)\s*/
  1. The first commit is a simple fix for / ambiguity.

  2. The next commit is a fix for an obvious circluar require between package.rb and packages/go_package.rb introduced via 860de9ea6f25b91c8dea1558a687e3d76a523d35.

  3. The third commit fixes a redundant Regexp literal.

You may notice some more warnings in package_managers/yarn.rb, but this seems to be already fixed via f57745be34bb7774577ea577671ea7b5c3246576 in master branch.

pivotal-cla commented 7 months ago

@amatsuda Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

cf-gitbot commented 7 months ago

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

The labels on this github issue will be updated when the story is started.

amatsuda commented 7 months ago

@pivotal-cla This is an Obvious Fix

pivotal-cla commented 7 months ago

@amatsuda This Pull Request contains an obvious fix. Signing the Contributor License Agreement is not necessary.