James Nugent
4b7727828a
Fix scanner tests on Windows
...
This is necessary because of the effects of autocrlf on Windows.
2016-03-20 23:14:42 +00:00
James Nugent
fdad785730
Merge pull request #93 from drewwells/feature/appveyor
...
first pass at appveyor build
2016-03-19 23:46:01 +00:00
Seth Vargo
defa3a4c5e
Merge pull request #103 from ebaratte/patch-3
...
added missing word
2016-03-18 11:40:51 -04:00
Etienne Baratte
f01aaf78c1
added missing word
2016-03-18 09:56:42 +01:00
Mitchell Hashimoto
567a5d1c48
Merge pull request #102 from hashicorp/b-bare-keys
...
Parse error on keys without values
2016-03-14 22:09:37 +01:00
Mitchell Hashimoto
99c4d58691
hcl/parser: better comments
2016-03-14 20:56:27 +01:00
Mitchell Hashimoto
faa2fba9b8
hcl/parser: error on bare object keys in object
2016-03-14 20:54:33 +01:00
Mitchell Hashimoto
7df3f8587e
hcl/parser: test for bare key at top level
2016-03-14 20:44:57 +01:00
Mitchell Hashimoto
c84febd4c1
Merge pull request #101 from mssola/printer-empty-node
...
printer: don't write a newline on empty objects
2016-03-14 15:48:00 +01:00
Miquel Sabaté Solà
0c3742819f
printer: don't write a newline on empty objects
...
This is to match the same criteria as in gofmt.
Fixes #94
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
2016-03-14 15:38:41 +01:00
Seth Vargo
78101eb3cb
Merge pull request #97 from hashicorp/pr-92
...
Add encoding API functions
2016-03-11 11:58:29 -05:00
Drew Wells
2799afc14b
adds std encoding API fixes #4
...
The std encoding format is Unmarshal([]byte, interface{}) error.
This naturally lends itself well to being passed readfile or exhausted
reader/buffer.
2016-03-10 15:36:44 -05:00
Seth Vargo
5b00661d05
Merge pull request #96 from hashicorp/sethvargo/top_level
...
Ensure top-level object literals are arrays
2016-03-10 14:14:02 -05:00
Seth Vargo
bebd6ba7ff
Ensure top-level object literals are arrays
...
Fixes GH-60
2016-03-10 14:04:52 -05:00
Mitchell Hashimoto
71c7409f1a
hcl/parser: add test case from TF issue
2016-03-01 10:33:45 -08:00
Drew Wells
e2e76d3e53
fix appveyor build
2016-02-29 23:04:50 -06:00
Mitchell Hashimoto
1c284ec98f
Parser enforces closing RBRACE [GH-88]
2016-02-10 10:31:11 -08:00
Mitchell Hashimoto
8cc8107682
hcl/parser: more negative number tests
2016-02-07 12:08:28 -08:00
Mitchell Hashimoto
4cae6d33fa
hcl/scanner: add test for negative number
2016-02-07 12:07:40 -08:00
Mitchell Hashimoto
a01f759c89
Merge pull request #85 from VladRassokhin/fix-list-comments-indent
...
Fix indent of list item comments
2016-02-07 10:45:49 -08:00
Mitchell Hashimoto
aa4dbbc2b7
hcl/printer: style change
2016-02-07 10:40:21 -08:00
Mitchell Hashimoto
e692f814c2
Merge pull request #84 from VladRassokhin/remote-tailing-spaces-in-lists
...
Printer should not produce tailing spaces in lists
2016-02-07 10:37:16 -08:00
Vladislav Rassokhin
d8e433406e
Fix indent of list item comments
2016-02-07 18:20:06 +03:00
Vladislav Rassokhin
63e2043a82
Printer should not produce tailing spaces in lists
2016-02-07 17:29:06 +03:00
Mitchell Hashimoto
e96d23138c
Merge pull request #80 from dcarley/fmtcmd
...
Add new fmtcmd package (linting)
2016-01-30 16:51:29 +01:00
Mitchell Hashimoto
90fb5b22fa
Merge pull request #83 from rhencke/patch-3
...
Document multi-line strings (here documents)
2016-01-30 14:55:26 +01:00
Robert Hencke
71f9cca07c
Document multi-line strings (here documents)
2016-01-24 09:05:04 -05:00
Mitchell Hashimoto
578dd97468
hcl/ast: just adding a GoSTringer impl
2016-01-19 12:27:37 -08:00
Dan Carley
aee8c49b75
Add new fmtcmd package
...
This uses the `printer` package to normalise HCL files. It's inspired by
github.com/fatih/hclfmt - but it differs in that it's intended to be more
generic, re-usable, and follow the semantics of `gofmt` or `go fmt`.
I intend to utilise this in Terraform by implementing `terraform fmt`
sub-command which will normalise all files in the current working directory
(like `go fmt ./..`) or contents over STDIN (with `terraform fmt -` that
could be used by editor plugins). So that Terraform users can benefit from
linting without installing another package/binary.
I hope that by placing most of the logic in the HCL package it should be
easy to implement sub-commands in other projects that also use HCL.
Some notes about the implementation:
- the significant difference from `gofmt` is that STDIN/STDOUT are passed in
and errors aren't logged/written directly to STDERR, which gives consumers
(e.g. Terraform) the ability to set appropriate exit codes
- I chose to use inline fixtures instead of files because there were a
number of times where I needed to reference the contents and group them
together with diff output
- it seemed simplest to construct the expected outputs by looping over the
relevant fixtures and building up a string/byte slice, hope it isn't too
confusing to read
- the test failure reporting is kind of rough because the outputs are so
large, but I didn't want to add another diff function
- I chose to have a separate test for sub-directories rather than making it
the default in the fixtures so that I didn't need to add additional logic
to the fixture rendering
- the fixtures are sorted by filename before any of the tests runs so that
they match the order that they are read from disk by `filepath.Walk()`
2016-01-06 21:53:58 +00:00
Paul Hinze
197e8d3cf4
Merge pull request #77 from hashicorp/phinze/poserror
...
add position to all decoder errors
2015-12-18 11:53:00 -06:00
Paul Hinze
d1e666a42d
add position to all decoder errors
...
Several of the esoteric syntax errors we encounter in Terraform have
bubbled up errors from the decoder. Since all these errors have a Node
in context, they can report their position which makes them _much_ more
helpful to the user, even if the error message itself is confusing.
I tried to move around PosError somewhere but got stuck finding a good
spot for it that doesn't have either a silly name or an import cycle, so
for now I'm just cross referencing into the parser package to reference
the error type.
2015-12-18 10:54:32 -06:00
Paul Hinze
5af5025c48
Merge pull request #76 from hashicorp/phinze/fix-missing-braces-crash
...
Fix crash on missing braces
2015-12-16 18:36:51 -06:00
Paul Hinze
3a2d43b647
Fix crash on missing braces
...
Fixes crash reported here https://github.com/hashicorp/terraform/issues/4350
2015-12-16 18:21:22 -06:00
Mitchell Hashimoto
e3dcd7fc89
Merge pull request #72 from savaki/master
...
adds facility for deferred Decode similar to how json.RawMessage enables deferred Unmarshal
2015-12-16 11:10:53 -08:00
Seth Vargo
17c5c97b5a
Merge pull request #74 from balexander-ot/patch-1
...
Update README.MD
2015-12-11 15:54:49 -05:00
balexander-ot
9900506682
Update README.MD
...
For the love of God and all that is holy.
2015-12-11 12:49:44 -08:00
Matt
1793d02c0e
- decoded structs may now use the ast.Node type to save the raw ast.Node; conceptually similar to how json.RawMessage works and is useful in situations where you would like to either (a) defer decoding or (b) require additional meta-data like #Pos
2015-12-06 21:31:48 -08:00
Paul Hinze
c40ec20b12
Merge pull request #71 from hashicorp/b-dos-line-endings
...
Fix scanner for Windows line endings and add tests
2015-12-01 12:18:49 -06:00
James Nugent
665d74b45d
Fix scanner for Windows line endings and add tests
2015-12-01 12:53:50 -05:00
James Nugent
cc4142e424
Merge pull request #70 from hashicorp/phinze/heredoc-ids-with-numbers
...
support heredoc identifiers with numbers
2015-12-01 12:13:28 -05:00
Paul Hinze
e2c26b8e6f
support heredoc identifiers with numbers
...
fixes https://github.com/hashicorp/terraform/issues/4079
2015-12-01 10:22:31 -06:00
James Nugent
8a65681ce2
Merge pull request #66 from hashicorp/b-heredoc-lists
...
Support HEREDOCs in lists
2015-11-29 11:28:44 +00:00
Mitchell Hashimoto
5bd8787dc9
Merge pull request #68 from Buzer/lastline_comment
...
Fixed hang when comment is on the last line of the file
2015-11-28 14:43:01 -08:00
Eljas Alakulppi
2ec27b6be2
Fixed hang when comment was on the last line of the file
2015-11-29 00:20:41 +02:00
James Nugent
f0ca992551
Merge pull request #67 from hashicorp/f-package-comment
...
Use Go convention of docs with "Package" prefix
2015-11-26 20:19:33 +00:00
James Nugent
6cf355fb61
Use Go convention of docs with "Package" prefix
2015-11-26 14:57:49 +02:00
James Nugent
eb77c8f861
Support HEREDOCs in lists
...
This fixes a regression in Terraform where HEREDOCS were previously
supported in lists, reported in hashicorp/terraform#4065 .
2015-11-26 14:52:16 +02:00
James Nugent
692d016087
Merge pull request #65 from hashicorp/b-map-identifiers
...
Fix scanning of identifiers of the form 'map.key'
2015-11-24 17:42:28 +02:00
James Nugent
c190e41403
Fix scanning of identifiers of the form 'map.key'
...
This is used in `.tfvars` files for Terraform in order to allow
overriding values in maps, for example:
map.key1 = "Value"
map.key2 = "OtherValue"
2015-11-24 15:13:07 +02:00
Mitchell Hashimoto
1688f22977
Merge pull request #64 from svanharmelen/b-fix-flattening-empty-objects
...
Fix flattening of empty objects
2015-11-20 09:26:51 -08:00