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

Fallback to summary field if detail exists but is empty in terraform linter #4157

Merged
merged 4 commits into from
May 16, 2022

Conversation

Sh1ftry
Copy link
Contributor

@Sh1ftry Sh1ftry commented Apr 15, 2022

Terraform linter incorrectly chooses empty detail field for message when both summary and detail fields exist in terraform validate output, but detail is empty. Example problematic output from terraform validate command:

{
  "format_version": "1.0",
  "valid": false,
  "error_count": 1,
  "warning_count": 0,
  "diagnostics": [
    {
      "severity": "error",
      "summary": "registry.terraform.io/hashicorp/aws: there is no package for registry.terraform.io/hashicorp/aws 4.9.0 cached in .terraform/providers",
      "detail": ""
    }
  ]
}

This PR fixes this by checking if detail is not empty before returning it.

@hsanson
Copy link
Contributor

hsanson commented Apr 17, 2022

There is a linting error. Adding this linter to your ale_linters configuration would make ALE warn you about these linting issues:

 'vim': ['vint', 'ale_custom_linting_rules'],

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@hsanson hsanson merged commit e343148 into dense-analysis:master May 16, 2022
@Sh1ftry Sh1ftry deleted the fix-terraform-detail branch May 16, 2022 20:53
cyyever pushed a commit to cyyever/ale that referenced this pull request Jul 11, 2022
…linter (dense-analysis#4157)

* Fallback to summary field if detail exists but is empty in terraform linter

* Add test

* Update terraform.vim

* remove whitespaces
cyyever pushed a commit to cyyever/ale that referenced this pull request Jul 11, 2022
…linter (dense-analysis#4157)

* Fallback to summary field if detail exists but is empty in terraform linter

* Add test

* Update terraform.vim

* remove whitespaces
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.

2 participants