mirror of
https://github.com/usetrmnl/trmnlp.git
synced 2026-08-13 14:27:33 -07:00
add support for "description" (tagline) attribute
This commit is contained in:
@@ -4,6 +4,7 @@ require_relative 'lint/check'
|
||||
require_relative 'lint/source'
|
||||
require_relative 'lint/checks/title_casing'
|
||||
require_relative 'lint/checks/title_length'
|
||||
require_relative 'lint/checks/description_length'
|
||||
require_relative 'lint/checks/layouts_have_content'
|
||||
require_relative 'lint/checks/no_async_functions'
|
||||
require_relative 'lint/checks/waits_for_dom_load'
|
||||
@@ -23,6 +24,7 @@ module TRMNLP
|
||||
CHECKS = [
|
||||
Checks::TitleCasing,
|
||||
Checks::TitleLength,
|
||||
Checks::DescriptionLength,
|
||||
Checks::LayoutsHaveContent,
|
||||
Checks::NoAsyncFunctions,
|
||||
Checks::WaitsForDomLoad,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../check'
|
||||
|
||||
module TRMNLP
|
||||
module Lint
|
||||
module Checks
|
||||
# MAX_LENGTH mirrors Plugin::MAX_DESCRIPTION_LENGTH in the hosted
|
||||
# service. Refresh it by hand when that constant changes, the same
|
||||
# policy db/data/form_fields.yml documents.
|
||||
#
|
||||
# Only the length is checked — a description is optional, so an
|
||||
# absent or empty one passes.
|
||||
class DescriptionLength < Check
|
||||
MAX_LENGTH = 35
|
||||
MESSAGE = "Description should be <= #{MAX_LENGTH} characters long.".freeze
|
||||
|
||||
private
|
||||
|
||||
def pass? = source.plugin_description.length <= MAX_LENGTH
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -16,6 +16,7 @@ module TRMNLP
|
||||
end
|
||||
|
||||
def plugin_name = settings['name'].to_s
|
||||
def plugin_description = settings['description'].to_s
|
||||
def settings = config.plugin.settings
|
||||
def custom_field_values = config.project.custom_fields
|
||||
def custom_field_definitions = config.plugin.custom_field_definitions
|
||||
|
||||
@@ -13,4 +13,5 @@ framework_version: latest
|
||||
polling_url: ''
|
||||
polling_headers: ''
|
||||
name: My Plugin
|
||||
description: ''
|
||||
refresh_interval: 1440
|
||||
|
||||
Reference in New Issue
Block a user