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

Style Guide corrections #98

Merged
merged 1 commit into from
Jul 7, 2017
Merged

Style Guide corrections #98

merged 1 commit into from
Jul 7, 2017

Conversation

mcgege
Copy link
Member

@mcgege mcgege commented Jul 5, 2017

No description provided.

@bitvijays
Copy link
Contributor

@mcgege Thanks for the PR. Are these changes as suggested by the Puppet-lint? http://puppet-lint.com/

@mcgege
Copy link
Member Author

mcgege commented Jul 6, 2017

@bitvijays Unfortunately Puppet-lint only covers a subset of the styling suggestions ... my changes are based on the official Style Guide and I hope they'll make future code changes easier.

puppet-lint didn't complain before and afterwards :-)

@bitvijays
Copy link
Contributor

@mcgege Thanks for the update. I had a quick look at the PR changes and the style guide. The below looks good to me
a) Must use one space between the resource type and opening brace, one space between the opening brace and the title, and no spaces between the title and colon.
b) Arrow Alignment
c) Resource attributes must be uniformly indented in two spaces from the title.
d) Must include trailing commas after all resource attributes and parameter definitions
e) Must end the last line with a new line
f) Removed single quotes from directory and follow

Is there anything else which you have included which I have missed? Is there any reason to enter a new line after the resource declaration? like in blacklist_files. I agree on the removal of the line between "exec" and "command"

@mcgege
Copy link
Member Author

mcgege commented Jul 6, 2017

@bitvijays I think this list pretty good summarizes it ... from my own "programming style guide" I applied this:
g) No spaces in function calls after opening bracket / before closing bracket
-> like template( 'xyz' )
h) Keep else and it's brackets in one line
-> } else {
i) After inital curly bracket + before last curly bracket insert a new line to separate function header / variables from code

But those are my personal style and adjustable :-)

@bitvijays
Copy link
Contributor

@mcgege Thank you for the information :) Would it be Okay.. if we just push "Puppet Style Guide" changes as of now? I am happy with your personal changes, however, currently, I can't think of how we can always make sure.. that other authors follow it and are happy with it?

@mcgege
Copy link
Member Author

mcgege commented Jul 7, 2017

@bitvijays Well, I don't insist on my personal changes, but ...
as of g) the formatting is now at least consistent - before some function calls had the spaces, some not (e.g. in suid_sgid.pp template('os_hardening/remove_sugid_bits.erb'))
h) I think this is definitely better readable

Of course we can't enforce these rules in the future (especially as it's not implemented in puppet-lint), but we could / should tidy up the code anyway from time to time :-)

@bitvijays
Copy link
Contributor

Okies. Thanks @mcgege for the pull request :) Much appreciated changes. Merged :)

@bitvijays bitvijays merged commit c34a88f into dev-sec:master Jul 7, 2017
@mcgege mcgege deleted the style-guide branch July 11, 2017 12:03
@artem-sidorenko
Copy link
Member

@mcgege @bitvijays puppet released puppet development kit:

It looks like there are this validators, linters etc which might be useful

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.

None yet

3 participants