Skip to content

Feature Request: report incorrect or malformed values in library.properties #1094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ianfixes opened this issue Dec 1, 2020 · 1 comment
Closed
Labels
type: enhancement Proposed improvement

Comments

@ianfixes
Copy link

ianfixes commented Dec 1, 2020

Feature Request

Create what is essentially a linting tool for library.properties. This would catch things like the following:

  • the library.properties filename is capitalized in an unexpected way (if case-sensitive filesystems would care)
  • the file contains binary, or has some other text encoding error
  • the file contains unexpected keys
  • a key contains an unparseable value
  • an expected key was not found

Example JSON output

{
  "file": {
    "path": "/path/to/Library.PROPerties",
    "issues": [
      {
        "severity": "warning",
        "message": "The library.properties filename should be all lowercase"
      },
      {
        "severity": "error",
        "message": "File contains binary data"
       }
    ]
  },
  "contents": {
    "parsed": {
        /* the parsed contents of the file */
    },
    "issues": [
      {
        "severity": "warning",
        "message": "The 'name' field was not found"
      },
      {
        "severity": "warning",
        "message": "Unexpected field 'potatoes'",
        "line": 4
      },
      {
        "severity": "error",
        "message": "field 'dot_a_linkage' expects a boolean",
        "line": 8
      },
    ]
  }
}

Having the line number reported in the output would enable GitHub annotations directly on the affected lines.

@per1234 per1234 added the type: enhancement Proposed improvement label Dec 1, 2020
@per1234
Copy link
Contributor

per1234 commented Jan 13, 2021

Thanks @ianfixes. As you noticed, we have now released the Arduino Lint tool which provides this capability and more:
https://blog.arduino.cc/2021/01/13/detect-problems-with-your-arduino-projects/

The only exception is this:

the file contains unexpected keys

The presence of arbitrary keys in library.properties doesn't cause any problems. People might use these for their own purposes. For example, some library authors began adding a license field even though this is not mentioned in the specification. What we do have is a check for potentially misspelled versions of optional key names (e.g., an architecture key when no architectures key is present).

As part of the Arduino Lint project, the library.properties data format is now defined in a machine readable form as a JSON schema:
https://github.com/arduino/arduino-lint/tree/main/etc/schemas

@per1234 per1234 closed this as completed Jan 13, 2021
@rsora rsora reopened this May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants