Skip to content
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

✨ Show warnings if keys dont have description #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hofp37
Copy link

@hofp37 hofp37 commented Jan 27, 2025

  • README update

Resolves #5

@hofp37 hofp37 requested a review from pavelsvagr January 27, 2025 16:35
@hofp37 hofp37 self-assigned this Jan 27, 2025
@hofp37 hofp37 force-pushed the feat/check-for-keys-without-description branch from 240b624 to ad0397c Compare January 28, 2025 07:52
}
if (document?.fileName.endsWith('.env.jsonc')) {
const text = document.getText()
const pattern = /\".*":/g
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This also applies to nested config keys. Usually, only the first-level fields are used since they can be set as env vars, but I don’t think we want to monitor what’s happening in nested fields if someone decides to use them. A comment on the first-level fields should be enough, right?
{
  "DB": { // This gets warning
     "host": "asdasd", // This get warning as well
     "port": "asad" // This get warning as well
  }
}
  1. Be careful, that this is also valid json:
{
            "DB"           :          false
}

path: path.posix.join(folderUri.path, '.env.jsonc'),
})

const lineAboveKey = document.lineAt(keyLine - 1).text.trim()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid env file here can break the code in my opinion (missing {} and first line is the matching pattern).

"EXTENSION FAIL": "nothing"

Documentation says that document.lineAt() expects non-negative int. Could you secure this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Add warning for keys without comments
2 participants