Skip to content

Commit

Permalink
Merge pull request #428 from jeffbyrnes/add-editorconfig
Browse files Browse the repository at this point in the history
Add EditorConfig
  • Loading branch information
sanfrancrisko committed May 10, 2021
2 parents e04486b + eb1b372 commit 377df33
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ PDK builds the configuration of the module by reading a set of default configura

Templates like this one can be used in conjunction with the PDK. As default the PDK itself uses the templates within this repository to render files for use within a module. Templates can be passed to the PDK as a flag for several of the commands.

> pdk convert --template-url https://github.com/puppetlabs/pdk-templates
```bash
pdk convert --template-url https://github.com/puppetlabs/pdk-templates
```

Please note that the template only needs to be passed in once if you wish to change it, every command run on the PDK will use the last specified template.
For more on basic usage and more detailed description of the PDK in action please refer to the [PDK documentation](https://github.com/puppetlabs/pdk/blob/main/README.md).
Expand All @@ -34,6 +36,18 @@ The following is a description and explanation of each of the keys within config
|:-----------------------|:------------|
| disable\_legacy\_facts | Set to `true` to configure PDK to prevent the use of [legacy Facter facts][legacy_facts_doc]. Currently this will install and enable the [legacy\_facts][legacy_facts_pl_plugin] plugin for puppet-lint for use during `pdk validate`. |

### .editorconfig

> EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.
Please see the [EditorConfig site](https://editorconfig.org) for details on how to install it as a plugin (or if your text editor or IDE includes support natively) and how to configure it.

To enable adding a `.editorconfig`:

```yaml
.editorconfig:
unmanaged: false
```
### .gitattributes
Expand Down Expand Up @@ -84,12 +98,11 @@ Gitlab CI uses a .gitlab-ci.yml file in the root of your repository tell Gitlab
### Gitpod configuration
If you are using Gitpod you will need to opt-in and enable gitpod support for pdk-templates. To do this simple set the following configurations.

```
```yaml
.gitpod.Dockerfile:
unmanaged: false
.gitpod.yml:
unmanaged: false
```

### Github Workflows
Expand Down
3 changes: 3 additions & 0 deletions config_defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ common:
writekey: 7f3c63a70eecc61d635917de46bea4e6
dataset: litmus tests

.editorconfig:
unmanaged: true
.gitattributes:
include:
'*.rb': 'eol=lf'
Expand Down Expand Up @@ -47,6 +49,7 @@ common:
required: *ignorepaths
paths:
- '/appveyor.yml'
- '/.editorconfig'
- '/.fixtures.yml'
- '/Gemfile'
- '/.gitattributes'
Expand Down
31 changes: 31 additions & 0 deletions moduleroot/.editorconfig.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; EditorConfig is awesome: http://EditorConfig.org

root = true

; Ruby style as default
; UTF-8 charset
; Unix-style newlines with a newline ending every file
; 2 space indent
; Trim trailing whitespace
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

; Markdown
; 4 space indent
; Trailing whitespace is potentially meaningful, leave it
[*.md]
indent_size = 4
trim_trailing_whitespace = false

; Shell scripts & Python
; 4 space indent
[*.{sh,py}]
indent_size = 4

[Makefile]
indent_style = tab

0 comments on commit 377df33

Please sign in to comment.