Class: RosettAi::Comply::Checkers::LicenseChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/comply/checkers/license_checker.rb

Overview

License compliance checker.

Verifies GPL-3.0-only compatibility of all dependencies, LICENSE file presence, and SPDX header coverage. Uses Gemfile.lock parsing for offline dependency audit.

Author:

  • hugo

  • claude

Constant Summary collapse

GPL_COMPATIBLE =
[
  'MIT', 'BSD-2-Clause', 'BSD-3-Clause', 'Apache-2.0', 'ISC', 'Zlib', '0BSD', 'Unlicense', 'LGPL-2.0-only', 'LGPL-2.0-or-later', 'LGPL-2.1-only', 'LGPL-2.1-or-later', 'LGPL-3.0-only', 'LGPL-3.0-or-later', 'GPL-2.0-only', 'GPL-2.0-or-later', 'GPL-3.0-only', 'GPL-3.0-or-later', 'Ruby', 'PSF-2.0', 'Artistic-2.0', 'MPL-2.0'
].freeze
GPL_INCOMPATIBLE =
[
  'AGPL-3.0-only', 'AGPL-3.0-or-later', 'SSPL-1.0', 'BUSL-1.1', 'Proprietary', 'CPAL-1.0', 'EUPL-1.1', 'EUPL-1.2'
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(project_root:, allowlist: []) ⇒ LicenseChecker

Returns a new instance of LicenseChecker.

Parameters:

  • project_root (Pathname)

    project root directory

  • allowlist (Array<String>) (defaults to: [])

    gem names exempt from license check



28
29
30
31
# File 'lib/rosett_ai/comply/checkers/license_checker.rb', line 28

def initialize(project_root:, allowlist: [])
  @project_root = project_root
  @allowlist = allowlist
end

Instance Method Details

#checkArray<Hash>

Runs all license compliance checks.

Returns:

  • (Array<Hash>)

    check results



36
37
38
39
40
41
# File 'lib/rosett_ai/comply/checkers/license_checker.rb', line 36

def check
  [
    check_gpl_compatible,
    check_license_file_present
  ]
end