Class: FlutterRb::PluginPubspecLintsCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/flutter_rb/checks/plugin_pubspec_check.rb

Overview

This class represents a check for Flutter plugin’s pubspec.yaml file for ‘lints’ dependency. It inherits from the Check class.

Constant Summary

Constants inherited from Check

Check::UNIMPLEMENTED_ERROR

Instance Method Summary collapse

Instance Method Details

#check(project) ⇒ CheckReport

Performs the check for the ‘lints’ dependency in the pubspec.yaml file. It creates a CheckReport object with the result of the check.

Parameters:

  • project (Project)

    the project to be checked

Returns:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 199

def check(project)
  pubspec = project.pubspec
  # Detects if 'lints' is a dependency in the pubspec file
  lints = pubspec.dev_dependencies&.detect do |dev_dependency|
    dev_dependency.name == 'lints'
  end

  # Creates a CheckReport object with the result of the check
  CheckReport.new(
    name,
    lints.nil? ? CheckReportStatus::ERROR : CheckReportStatus::NORMAL,
    description,
    pubspec.path
  )
end

#descriptionString

Returns the description of the check. The description explains what the check is validating.

Returns:

  • (String)

    the description of the check



190
191
192
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 190

def description
  'Check Flutter plugin lints dependency in pubspec file'
end

#nameString

Returns the name of the check.

Returns:

  • (String)

    the name of the check



182
183
184
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 182

def name
  'PluginPubspecLintsCheck'
end