From fc202f41068df17f09bc4ccdf0db706c749006cd Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 May 2021 02:27:10 -0700 Subject: [PATCH 1/3] Use Arduino Lint to validate releases Arduino Lint allows library maintainers to use the same tool locally and in CI as will be used to validate the library submission and its releases. This provides transparency for the whole process and should reduce the Library Manager index support burden. --- .github/workflows/test-go.yml | 14 ++ libraries/lint.go | 100 +++++++++++++++ libraries/lint_test.go | 108 ++++++++++++++++ libraries/repoclone.go | 11 -- .../libraries/Arduino_MKRRGB/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_MKRRGB/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_MKRRGB/library.properties | 9 ++ .../Arduino_MKRRGB/src/Arduino_MKRRGB.h | 0 .../libraries/Arduino_Test3rd/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_Test3rd/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_Test3rd/library.properties | 9 ++ .../Arduino_Test3rd/src/Arduino_Test3rd.h | 0 .../libraries/Arduino_TestErr/.development | 1 + .../libraries/Arduino_TestErr/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_TestErr/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_TestErr/library.properties | 9 ++ .../Arduino_TestErr/src/Arduino_TestErr.h | 0 .../libraries/Arduino_TestOff/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_TestOff/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_TestOff/library.properties | 9 ++ .../Arduino_TestOff/src/Arduino_TestOff.h | 0 .../libraries/Arduino_TestPass/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_TestPass/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_TestPass/library.properties | 9 ++ .../Arduino_TestPass/src/Arduino_TestPass.h | 0 .../libraries/Arduino_TestWarn/LICENSE.txt | 121 ++++++++++++++++++ .../libraries/Arduino_TestWarn/README.md | 0 .../examples/Example/Example.ino | 2 + .../Arduino_TestWarn/library.properties | 9 ++ .../Arduino_TestWarn/src/Arduino_TestWarn.h | 0 sync_libraries.go | 14 +- 36 files changed, 1024 insertions(+), 16 deletions(-) create mode 100644 libraries/lint.go create mode 100644 libraries/lint_test.go create mode 100644 libraries/testdata/libraries/Arduino_MKRRGB/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_MKRRGB/README.md create mode 100644 libraries/testdata/libraries/Arduino_MKRRGB/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_MKRRGB/library.properties create mode 100644 libraries/testdata/libraries/Arduino_MKRRGB/src/Arduino_MKRRGB.h create mode 100644 libraries/testdata/libraries/Arduino_Test3rd/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_Test3rd/README.md create mode 100644 libraries/testdata/libraries/Arduino_Test3rd/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_Test3rd/library.properties create mode 100644 libraries/testdata/libraries/Arduino_Test3rd/src/Arduino_Test3rd.h create mode 100644 libraries/testdata/libraries/Arduino_TestErr/.development create mode 100644 libraries/testdata/libraries/Arduino_TestErr/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_TestErr/README.md create mode 100644 libraries/testdata/libraries/Arduino_TestErr/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_TestErr/library.properties create mode 100644 libraries/testdata/libraries/Arduino_TestErr/src/Arduino_TestErr.h create mode 100644 libraries/testdata/libraries/Arduino_TestOff/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_TestOff/README.md create mode 100644 libraries/testdata/libraries/Arduino_TestOff/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_TestOff/library.properties create mode 100644 libraries/testdata/libraries/Arduino_TestOff/src/Arduino_TestOff.h create mode 100644 libraries/testdata/libraries/Arduino_TestPass/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_TestPass/README.md create mode 100644 libraries/testdata/libraries/Arduino_TestPass/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_TestPass/library.properties create mode 100644 libraries/testdata/libraries/Arduino_TestPass/src/Arduino_TestPass.h create mode 100644 libraries/testdata/libraries/Arduino_TestWarn/LICENSE.txt create mode 100644 libraries/testdata/libraries/Arduino_TestWarn/README.md create mode 100644 libraries/testdata/libraries/Arduino_TestWarn/examples/Example/Example.ino create mode 100644 libraries/testdata/libraries/Arduino_TestWarn/library.properties create mode 100644 libraries/testdata/libraries/Arduino_TestWarn/src/Arduino_TestWarn.h diff --git a/.github/workflows/test-go.yml b/.github/workflows/test-go.yml index 8ba6fcb5..225dbdf3 100644 --- a/.github/workflows/test-go.yml +++ b/.github/workflows/test-go.yml @@ -62,6 +62,20 @@ jobs: with: go-version: "1.14" + - name: Install Arduino Lint + run: | + ARDUINO_LINT_INSTALLATION_PATH="${{ runner.temp }}/arduino-lint" + mkdir --parents "$ARDUINO_LINT_INSTALLATION_PATH" + curl \ + -fsSL \ + https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh \ + | \ + BINDIR="$ARDUINO_LINT_INSTALLATION_PATH" \ + sh + + # Add installation folder to path to path + echo "$ARDUINO_LINT_INSTALLATION_PATH" >> "$GITHUB_PATH" + - name: Install Taskfile uses: arduino/actions/setup-taskfile@master with: diff --git a/libraries/lint.go b/libraries/lint.go new file mode 100644 index 00000000..e9768425 --- /dev/null +++ b/libraries/lint.go @@ -0,0 +1,100 @@ +// This file is part of libraries-repository-engine. +// +// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package libraries + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "os/exec" + "path/filepath" +) + +var empty struct{} + +var officialTypes = map[string]struct{}{ + "Arduino": empty, +} + +func official(metadata *Repo) bool { + for _, libraryType := range metadata.Types { + _, isOfficial := officialTypes[libraryType] + if isOfficial { + return true + } + } + return false +} + +// RunArduinoLint runs Arduino Lint on the library and returns the report in the event of error or warnings. +func RunArduinoLint(folder string, metadata *Repo) ([]byte, error) { + JSONReportFolder, err := ioutil.TempDir("", "arduino-lint-report-") + if err != nil { + panic(err) + } + JSONReportPath := filepath.Join(JSONReportFolder, "report.json") + defer os.RemoveAll(JSONReportPath) + + // See: https://arduino.github.io/arduino-lint/latest/commands/arduino-lint/ + cmd := exec.Command( + "arduino-lint", + "--compliance=permissive", + "--format=text", + "--project-type=library", + "--recursive=false", + "--report-file="+JSONReportPath, + folder, + ) + // See: https://arduino.github.io/arduino-lint/latest/#environment-variables + cmd.Env = modifyEnv(os.Environ(), "ARDUINO_LINT_LIBRARY_MANAGER_INDEXING", "true") + cmd.Env = modifyEnv(cmd.Env, "ARDUINO_LINT_OFFICIAL", fmt.Sprintf("%t", official(metadata))) + + textReport, lintErr := cmd.CombinedOutput() + if lintErr != nil { + return textReport, lintErr + } + + // Read report. + rawJSONReport, err := ioutil.ReadFile(JSONReportPath) + if err != nil { + panic(err) + } + var JSONReport map[string]interface{} + if err := json.Unmarshal(rawJSONReport, &JSONReport); err != nil { + panic(err) + } + + // Check warning count. + reportSummary := JSONReport["summary"].(map[string]interface{}) + warningCount := reportSummary["warningCount"].(float64) + + // Report should be displayed when there are warnings. + if warningCount > 0 { + return textReport, lintErr + } + + // No warnings. + return nil, nil +} diff --git a/libraries/lint_test.go b/libraries/lint_test.go new file mode 100644 index 00000000..fbb9a849 --- /dev/null +++ b/libraries/lint_test.go @@ -0,0 +1,108 @@ +// This file is part of libraries-repository-engine. +// +// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published +// by the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package libraries + +import ( + "os" + "path/filepath" + "regexp" + "testing" + + "github.com/stretchr/testify/assert" +) + +var testDataPath string + +func init() { + workingDirectory, err := os.Getwd() + if err != nil { + panic(err) + } + testDataPath = filepath.Join(workingDirectory, "testdata") +} + +func TestRunArduinoLint(t *testing.T) { + testTables := []struct { + testName string + folder string + official bool + reportRegexp string + errorAssertion assert.ErrorAssertionFunc + }{ + { + "update", + "Arduino_MKRRGB", + true, + "^$", + assert.NoError, + }, + { + "official", + "Arduino_TestOff", + true, + "^$", + assert.NoError, + }, + { + "unofficial", + "Arduino_Test3rd", + false, + "LP012", + assert.NoError, + }, + { + "error", + "Arduino_TestErr", + true, + "LS006", + assert.Error, + }, + { + "warning", + "Arduino_TestWarn", + true, + "LP015", + assert.NoError, + }, + { + "pass", + "Arduino_TestPass", + true, + "^$", + assert.NoError, + }, + } + + for _, testTable := range testTables { + var metadata Repo + if testTable.official { + metadata.Types = []string{"Arduino"} + } else { + metadata.Types = []string{"Contributed"} + } + report, err := RunArduinoLint(filepath.Join(testDataPath, "libraries", testTable.folder), &metadata) + assert.Regexp(t, regexp.MustCompile(testTable.reportRegexp), string(report), testTable.testName) + testTable.errorAssertion(t, err, testTable.testName) + } +} diff --git a/libraries/repoclone.go b/libraries/repoclone.go index c07d8cab..b0801069 100644 --- a/libraries/repoclone.go +++ b/libraries/repoclone.go @@ -24,7 +24,6 @@ package libraries import ( - "errors" "io/ioutil" "os" "path/filepath" @@ -100,16 +99,6 @@ func GenerateLibraryFromRepo(repo *Repository) (*metadata.LibraryMetadata, error return nil, err } - libraryErrors := library.Validate() - if len(libraryErrors) > 0 { - var errorsString []string - for _, error := range libraryErrors { - errorsString = append(errorsString, error.Error()) - } - combinedErrors := strings.Join(errorsString, ",") - return nil, errors.New(combinedErrors) - } - return library, nil } diff --git a/libraries/testdata/libraries/Arduino_MKRRGB/LICENSE.txt b/libraries/testdata/libraries/Arduino_MKRRGB/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_MKRRGB/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_MKRRGB/README.md b/libraries/testdata/libraries/Arduino_MKRRGB/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_MKRRGB/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_MKRRGB/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_MKRRGB/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_MKRRGB/library.properties b/libraries/testdata/libraries/Arduino_MKRRGB/library.properties new file mode 100644 index 00000000..b5ed5795 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_MKRRGB/library.properties @@ -0,0 +1,9 @@ +name=Arduino_MKRRGB +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_MKRRGB/src/Arduino_MKRRGB.h b/libraries/testdata/libraries/Arduino_MKRRGB/src/Arduino_MKRRGB.h new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_Test3rd/LICENSE.txt b/libraries/testdata/libraries/Arduino_Test3rd/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_Test3rd/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_Test3rd/README.md b/libraries/testdata/libraries/Arduino_Test3rd/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_Test3rd/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_Test3rd/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_Test3rd/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_Test3rd/library.properties b/libraries/testdata/libraries/Arduino_Test3rd/library.properties new file mode 100644 index 00000000..046afe12 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_Test3rd/library.properties @@ -0,0 +1,9 @@ +name=Arduino_Test3rd +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_Test3rd/src/Arduino_Test3rd.h b/libraries/testdata/libraries/Arduino_Test3rd/src/Arduino_Test3rd.h new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestErr/.development b/libraries/testdata/libraries/Arduino_TestErr/.development new file mode 100644 index 00000000..67f5bf99 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestErr/.development @@ -0,0 +1 @@ +This file added to violate Arduino Lint rule LS006 diff --git a/libraries/testdata/libraries/Arduino_TestErr/LICENSE.txt b/libraries/testdata/libraries/Arduino_TestErr/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestErr/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_TestErr/README.md b/libraries/testdata/libraries/Arduino_TestErr/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestErr/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_TestErr/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestErr/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_TestErr/library.properties b/libraries/testdata/libraries/Arduino_TestErr/library.properties new file mode 100644 index 00000000..03c98c19 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestErr/library.properties @@ -0,0 +1,9 @@ +name=Arduino_TestErr +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_TestErr/src/Arduino_TestErr.h b/libraries/testdata/libraries/Arduino_TestErr/src/Arduino_TestErr.h new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestOff/LICENSE.txt b/libraries/testdata/libraries/Arduino_TestOff/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestOff/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_TestOff/README.md b/libraries/testdata/libraries/Arduino_TestOff/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestOff/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_TestOff/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestOff/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_TestOff/library.properties b/libraries/testdata/libraries/Arduino_TestOff/library.properties new file mode 100644 index 00000000..92c76353 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestOff/library.properties @@ -0,0 +1,9 @@ +name=Arduino_TestOff +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_TestOff/src/Arduino_TestOff.h b/libraries/testdata/libraries/Arduino_TestOff/src/Arduino_TestOff.h new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestPass/LICENSE.txt b/libraries/testdata/libraries/Arduino_TestPass/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestPass/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_TestPass/README.md b/libraries/testdata/libraries/Arduino_TestPass/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestPass/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_TestPass/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestPass/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_TestPass/library.properties b/libraries/testdata/libraries/Arduino_TestPass/library.properties new file mode 100644 index 00000000..eb0a84fb --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestPass/library.properties @@ -0,0 +1,9 @@ +name=Arduino_TestPass +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_TestPass/src/Arduino_TestPass.h b/libraries/testdata/libraries/Arduino_TestPass/src/Arduino_TestPass.h new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestWarn/LICENSE.txt b/libraries/testdata/libraries/Arduino_TestWarn/LICENSE.txt new file mode 100644 index 00000000..0e259d42 --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestWarn/LICENSE.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/libraries/testdata/libraries/Arduino_TestWarn/README.md b/libraries/testdata/libraries/Arduino_TestWarn/README.md new file mode 100644 index 00000000..e69de29b diff --git a/libraries/testdata/libraries/Arduino_TestWarn/examples/Example/Example.ino b/libraries/testdata/libraries/Arduino_TestWarn/examples/Example/Example.ino new file mode 100644 index 00000000..660bdbcc --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestWarn/examples/Example/Example.ino @@ -0,0 +1,2 @@ +void setup() {} +void loop() {} diff --git a/libraries/testdata/libraries/Arduino_TestWarn/library.properties b/libraries/testdata/libraries/Arduino_TestWarn/library.properties new file mode 100644 index 00000000..258089ba --- /dev/null +++ b/libraries/testdata/libraries/Arduino_TestWarn/library.properties @@ -0,0 +1,9 @@ +name=Arduino TestWarn +version=1.0.0 +author=Cristian Maglie , Pippo Pluto +maintainer=Cristian Maglie +sentence=A library that makes coding a Webserver a breeze. +paragraph=Supports HTTP1.1 and you can do GET and POST. +category=Communication +url=http://example.com/ +architectures=avr diff --git a/libraries/testdata/libraries/Arduino_TestWarn/src/Arduino_TestWarn.h b/libraries/testdata/libraries/Arduino_TestWarn/src/Arduino_TestWarn.h new file mode 100644 index 00000000..e69de29b diff --git a/sync_libraries.go b/sync_libraries.go index 720adcca..6e393786 100644 --- a/sync_libraries.go +++ b/sync_libraries.go @@ -290,11 +290,6 @@ func syncLibraryTaggedRelease(logger *log.Logger, repo *libraries.Repository, ta return nil } - // Check if the library has undesried files - if err := libraries.FailIfHasUndesiredFiles(repo.FolderPath); err != nil { - return err - } - if !config.DoNotRunClamav { if out, err := libraries.RunAntiVirus(repo.FolderPath); err != nil { logger.Printf("clamav output:\n%s", out) @@ -302,6 +297,15 @@ func syncLibraryTaggedRelease(logger *log.Logger, repo *libraries.Repository, ta } } + report, err := libraries.RunArduinoLint(repo.FolderPath, repoMeta) + if err != nil { + logger.Printf("Arduino Lint found errors:\n%s", report) + return err + } + if report != nil { + logger.Printf("Arduino Lint has suggestions for possible improvements:\n%s", report) + } + zipName := libraries.ZipFolderName(library) lib := filepath.Base(filepath.Clean(filepath.Join(repo.FolderPath, ".."))) host := filepath.Base(filepath.Clean(filepath.Join(repo.FolderPath, "..", ".."))) From 0c3260d7d0c2e4cbbbc0321da30428e08b3a353f Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 11 May 2021 02:37:34 -0700 Subject: [PATCH 2/3] Remove redundant validation code This functionality is now provided by Arduino Lint. --- libraries/metadata/metadata.go | 105 ---------------------------- libraries/metadata/metadata_test.go | 45 ------------ 2 files changed, 150 deletions(-) delete mode 100644 libraries/metadata/metadata_test.go diff --git a/libraries/metadata/metadata.go b/libraries/metadata/metadata.go index 3733da17..c1000822 100644 --- a/libraries/metadata/metadata.go +++ b/libraries/metadata/metadata.go @@ -40,8 +40,6 @@ import ( "context" "encoding/base64" "errors" - "regexp" - "strings" "github.com/google/go-github/github" ini "github.com/vaughan0/go-ini" @@ -64,109 +62,6 @@ type LibraryMetadata struct { Depends string } -const categoryUcategorized string = "Uncategorized" - -var validCategories = []string{ - "Display", - "Communication", - "Signal Input/Output", - "Sensors", - "Device Control", - "Timing", - "Data Storage", - "Data Processing", - "Other", - categoryUcategorized, -} - -// IsValidCategory checks if category is a valid category -func IsValidCategory(category string) bool { - for _, c := range validCategories { - if category == c { - return true - } - } - return false -} - -// Validate checks LibraryMetadata for errors, returns an array of the errors found -func (library *LibraryMetadata) Validate() []error { - var errorsAccumulator []error - - // Check lib name - if !IsValidLibraryName(library.Name) { - errorsAccumulator = append(errorsAccumulator, errors.New("Invalid 'name' field: "+library.Name)) - } - - // Check author and maintainer existence - if library.Author == "" { - errorsAccumulator = append(errorsAccumulator, errors.New("'author' field must be defined")) - } - if library.Maintainer == "" { - library.Maintainer = library.Author - } - - // Check sentence and paragraph and url existence - if library.Sentence == "" || library.URL == "" { - errorsAccumulator = append(errorsAccumulator, errors.New("'sentence' and 'url' fields must be defined")) - } - - newVersion, err := VersionToSemverCompliant(library.Version) - if err != nil { - errorsAccumulator = append(errorsAccumulator, err) - } - library.Version = newVersion - - // Check if the category is valid and set to "Uncategorized" if not - if !IsValidCategory(library.Category) { - library.Category = categoryUcategorized - } - - // Check if 'depends' field is correctly written - if !IsValidDependency(library.Depends) { - errorsAccumulator = append(errorsAccumulator, errors.New("Invalid 'depends' field: "+library.Depends)) - } - return errorsAccumulator -} - -// IsValidLibraryName checks if a string is a valid library name -func IsValidLibraryName(name string) bool { - if len(name) == 0 { - return false - } - if name[0] == '-' || name[0] == '_' || name[0] == ' ' { - return false - } - for _, char := range name { - if !strings.Contains("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-. ", string(char)) { - return false - } - } - return true -} - -var re = regexp.MustCompile("^([a-zA-Z0-9](?:[a-zA-Z0-9._\\- ]*[a-zA-Z0-9])?) *(?: \\(([^()]*)\\))?$") - -// IsValidDependency checks if the `depends` field of library.properties is correctly formatted -func IsValidDependency(depends string) bool { - // TODO: merge this method with db.ExtractDependenciesList - depends = strings.TrimSpace(depends) - if depends == "" { - return true - } - for _, dep := range strings.Split(depends, ",") { - dep = strings.TrimSpace(dep) - if dep == "" { - return false - } - matches := re.FindAllStringSubmatch(dep, -1) - if matches == nil { - return false - } - } - return true -} - // ParsePullRequest makes a LibraryMetadata by reading library.properties from a github.PullRequest func ParsePullRequest(gh *github.Client, pull *github.PullRequest) (*LibraryMetadata, error) { head := *pull.Head diff --git a/libraries/metadata/metadata_test.go b/libraries/metadata/metadata_test.go deleted file mode 100644 index 63357fcd..00000000 --- a/libraries/metadata/metadata_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of libraries-repository-engine. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package metadata - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func TestMetadataChecks(t *testing.T) { - require.True(t, IsValidLibraryName("asjdh qweqwe - qweqwe_213123")) - require.False(t, IsValidLibraryName("-asdasda")) - require.False(t, IsValidLibraryName("_")) - require.False(t, IsValidLibraryName(" asdasd")) - require.False(t, IsValidLibraryName("asd$")) - - require.True(t, IsValidDependency("asdas")) - require.True(t, IsValidDependency("asdas asdadasd,123213")) - require.False(t, IsValidDependency("asdas asdadasd,,123213")) - require.True(t, IsValidDependency("")) - require.False(t, IsValidDependency("_123123,asdasd")) - require.False(t, IsValidDependency("435regf,asdkwjqwe,_ger,213123")) -} From db141b3c444be5318f0ca6305f0d89d37057ae67 Mon Sep 17 00:00:00 2001 From: per1234 Date: Thu, 13 May 2021 04:51:31 -0700 Subject: [PATCH 3/3] Fold Arduino Lint report in logs The Arduino Lint report is shown in the logs whenever a warning or error is encountered while validating a release before adding it to the index. The report is fairly verbose. Putting it in a "details" section allow the reader to get the quick overview of the indexing results that was provided by the previous log format, while also offering the option to get details about the results of the validation. --- sync_libraries.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sync_libraries.go b/sync_libraries.go index 6e393786..ca561a10 100644 --- a/sync_libraries.go +++ b/sync_libraries.go @@ -298,12 +298,18 @@ func syncLibraryTaggedRelease(logger *log.Logger, repo *libraries.Repository, ta } report, err := libraries.RunArduinoLint(repo.FolderPath, repoMeta) + reportTemplate := `Arduino Lint %s: +
Click to expand Arduino Lint report +
+%s +
+
` if err != nil { - logger.Printf("Arduino Lint found errors:\n%s", report) + logger.Printf(reportTemplate, "found errors", report) return err } if report != nil { - logger.Printf("Arduino Lint has suggestions for possible improvements:\n%s", report) + logger.Printf(reportTemplate, "has suggestions for possible improvements", report) } zipName := libraries.ZipFolderName(library)