Comments (8)
This seems to be a Windows-specific issue. Gotta be some kind of CRLF problem if I had to guess. I'll keep looking into it.
from yamlfmt.
I managed to find the problem in the parser code too. Opened go-yaml/yaml#893 and go-yaml/yaml#894
from yamlfmt.
I would like to update that this issue is not happening again and the hotfix is working correctly. Thank you
from yamlfmt.
Hi @sharuzzaman,
Unfortunately at this time there aren't a ton of configuration options, so you wouldn't be able to configure a behaviour like this for the time being.
However, I'm unable to reproduce this behaviour locally at the moment. I tried copying the yaml from the first block into a file on its own and it did not insert the newlines as you've mentioned.
x.yaml:
---
Resources:
ElasticBeanstalk:
Type: AWS::CloudFormation::Stack
Properties:
#NotificationARNs:
# - String
#Parameters:
# Key : Value
#Tags:
# - Tag
TemplateURL: https://examplebucket.s3.ap-southeast-1.amazonaws.com/example-file.json
TimeoutInMinutes: 5
Piping it into stdin
:
braydonk@bk:~/Git/yamlfmt$ cat x.yaml | yamlfmt -
---
Resources:
ElasticBeanstalk:
Type: AWS::CloudFormation::Stack
Properties:
#NotificationARNs:
# - String
#Parameters:
# Key : Value
#Tags:
# - Tag
TemplateURL: https://examplebucket.s3.ap-southeast-1.amazonaws.com/example-file.json
TimeoutInMinutes: 5
There's a chance this is a platform issue. I'm running this on Linux. What operating system are you on?
from yamlfmt.
I'm running yamlfmt on Windows 10 using the Windows command line
from yamlfmt.
This is tough. It's a combination of 2 bugs in yaml.v3
, one is pretty simple and one is not.
yaml.Encoder
always writes \n
, I'll make a PR upstream that makes it configurable to write \r\n
instead
When the parser scans a head comment ending in \r\n
, if the next line is anything but another line break, it inserts an extra line. This is deep in the parser code, and won't be fast to solve...
The silver lining is that this is not a universal Windows issue, this is particularly with CRLF line endings. That is a possible workaround if you are flexible with line endings in your project. Regardless, I'll do what I can to get this solved.
from yamlfmt.
For the line ending problem, I opened go-yaml/yaml#891 and a PR for it go-yaml/yaml#892
from yamlfmt.
I've opened a hotfix for the behaviour while waiting for the upstream stuff to get fixed, and that's what will go in v0.3.0 so that Windows users can be fixed sooner.
from yamlfmt.
Related Issues (20)
- Exclude patterns not working as expected HOT 3
- Consider reading configuration from .yamlfmt.yml and .yamlfmt.yaml files HOT 1
- Consider to change/improve configfile discovery HOT 7
- W3C YAML-LD HOT 7
- feature request: ignore specific lines instead of entire file HOT 3
- VS Code extension HOT 4
- Support reviewdog HOT 1
- don't remove newline from end of file HOT 1
- Ordered keys HOT 1
- 0.10.0 release? HOT 2
- Add option to remove trailing spaces HOT 2
- Unexpected reformatting of block scalar? HOT 2
- Preserve multiline for line ending with \ HOT 4
- Exclude is still a little bit wonky HOT 8
- Feature Request: Optional exclude content from .gitignore HOT 1
- Docs request: `best_width`, YAML library HOT 2
- Request: `indent` being respected beyond top level HOT 1
- Support system-installed yamlfmt HOT 15
- Wrong front matter interpretation HOT 1
- Feature request: allow to retain some empty lines HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yamlfmt.