A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-lint/commit/ac6f9a3362a26eeb5b3751fc2ab83f930a618607 below:

Add reference URL field to rule configuration · arduino/arduino-lint@ac6f9a3 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+438

-128

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+438

-128

lines changed Original file line number Diff line number Diff line change

@@ -109,6 +109,9 @@ func (results *Type) Record(lintedProject project.Type, ruleConfiguration ruleco

109 109

ruleMessage := ""

110 110

if ruleResult == ruleresult.Fail {

111 111

ruleMessage = message(ruleConfiguration.MessageTemplate, ruleOutput)

112 +

if ruleConfiguration.Reference != "" {

113 +

ruleMessage = fmt.Sprintf("%s\nSee: %s", ruleMessage, ruleConfiguration.Reference)

114 +

}

112 115

} else {

113 116

// Rules may provide an explanation for their non-fail result.

114 117

// The message template should not be used in this case, since it is written for a failure result.

Original file line number Diff line number Diff line change

@@ -76,9 +76,14 @@ func TestRecord(t *testing.T) {

76 76

ruleOutput := "foo"

77 77

flags.Set("verbose", "true")

78 78

require.Nil(t, configuration.Initialize(flags, projectPaths))

79 +

ruleConfiguration.Reference = ""

79 80

summaryText := results.Record(lintedProject, ruleConfiguration, ruleresult.Fail, ruleOutput)

80 -

outputAssertion := "Rule LS001 result: fail\nERROR: Path does not contain a valid Arduino library. See: \n https://arduino.github.io/arduino-cli/latest/library-specification \n"

81 -

assert.Equal(t, outputAssertion, summaryText)

81 +

outputAssertion := "Rule LS001 result: fail\nERROR: Path does not contain a valid Arduino library.\n"

82 +

assert.Equal(t, outputAssertion, summaryText, "No reference URL")

83 +

ruleConfiguration.Reference = "https://arduino.github.io/arduino-cli/latest/library-specification"

84 +

summaryText = results.Record(lintedProject, ruleConfiguration, ruleresult.Fail, ruleOutput)

85 +

outputAssertion = "Rule LS001 result: fail\nERROR: Path does not contain a valid Arduino library. \n See: https://arduino.github.io/arduino-cli/latest/library-specification\n"

86 +

assert.Equal(t, outputAssertion, summaryText, "Reference URL is appended if one is defined")

82 87

summaryText = results.Record(lintedProject, ruleConfiguration, ruleresult.NotRun, ruleOutput)

83 88

assert.Equal(t, fmt.Sprintf("Rule %s result: %s\n%s: %s\n", ruleConfiguration.ID, ruleresult.NotRun, rulelevel.Notice, ruleOutput), summaryText, "Non-fail result should not use message")

84 89

summaryText = results.Record(lintedProject, ruleConfiguration, ruleresult.Pass, "")

@@ -87,6 +92,7 @@ func TestRecord(t *testing.T) {

87 92

require.Nil(t, configuration.Initialize(flags, projectPaths))

88 93

ruleConfigurationCopy := ruleConfiguration

89 94

ruleConfigurationCopy.MessageTemplate = "bar"

95 +

ruleConfigurationCopy.Reference = ""

90 96

summaryText = results.Record(lintedProject, ruleConfigurationCopy, ruleresult.Fail, ruleOutput)

91 97

outputAssertion = "ERROR: bar (Rule LS001)\n"

92 98

assert.Equal(t, outputAssertion, summaryText, "Rule ID is appended to non-verbose fail message on same line when rule message is single line")

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4