hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
375 stars 64 forks source link

hcl/hclsyntax: Improve error reporting for comma-separated args #79

Closed radeksimko closed 5 years ago

radeksimko commented 5 years ago

It turns out that some people separate argument definitions with commas even when these are each on new lines.

Here's a real example I found in acceptance test of the Fastly provider while attempting to upgrade it:

resource "fastly_service_v1" "foo" {
  name = "..."

  bigquerylogging {
    name       = "%s"
    email      = "email@example.com",
    secret_key = "secretKey",
    project_id = "example-gcp-project"
    dataset    = "example-bq-dataset"
    table      = "example-bq-table"
  }
}

Hence I think this case deserves a special error message.

Message before patch

screen shot 2019-01-24 at 11 53 51

Message after patch

screen shot 2019-01-24 at 11 56 06

codecov-io commented 5 years ago

Codecov Report

Merging #79 into master will increase coverage by 0.14%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
+ Coverage   65.75%   65.89%   +0.14%     
==========================================
  Files          97       97              
  Lines       10243    10248       +5     
==========================================
+ Hits         6735     6753      +18     
+ Misses       3179     3167      -12     
+ Partials      329      328       -1
Impacted Files Coverage Δ
hcl/hclsyntax/parser.go 63.21% <100%> (+1.11%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7b147fb...1ce4a00. Read the comment docs.