Class: FlutterRb::PluginPubspecFlutterLintsCheck

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 ‘flutter_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 ‘flutter_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:



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 239

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

  # Creates a CheckReport object with the result of the check
  CheckReport.new(
    name,
    flutter_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



230
231
232
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 230

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

#nameString

Returns the name of the check.

Returns:

  • (String)

    the name of the check



222
223
224
# File 'lib/flutter_rb/checks/plugin_pubspec_check.rb', line 222

def name
  'PluginPubspecFlutterLintsCheck'
end