Skip to content

Commit 67b0b33

Browse files
committed
review docs for release
1 parent 866a17a commit 67b0b33

File tree

6 files changed

+129
-114
lines changed

6 files changed

+129
-114
lines changed

CONTRIBUTING.md

Lines changed: 63 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
# How to contribute
33

4-
You can use this document not only to see how to contribute code but also to prepare yourself to
5-
extend this firewall project for your own personal or corporate needs.
4+
You can use this document not only to see how to contribute code but also to prepare yourself to\
5+
extend this firewall for your personal or corporate needs.
66

77
Here is a list of most important things to keep in mind.
88

@@ -27,7 +27,7 @@ Here is a list of most important things to keep in mind.
2727
- [Portability and other systems](#portability-and-other-systems)
2828
- [Making new scripts or modules](#making-new-scripts-or-modules)
2929
- [Repository folder structure](#repository-folder-structure)
30-
- [Final notes and where to start](#final-notes-and-where-to-start)
30+
- [Where to start](#where-to-start)
3131

3232
## General guidelines
3333

@@ -69,8 +69,8 @@ It is highly recommended to stick with Visual Studio Code, because this project
6969
specific to Visual Studio Code, aka. "Workspace", these settings include:
7070

7171
1. Code formatting settings which are automatically enforced, and can also be manually applied
72-
2. List of recommended extensions which are automatically listed for installation when you open
73-
project root folder
72+
2. List of recommended extensions which are automatically listed for installation once you open\
73+
repository root folder with VSCode
7474
3. Debugging and code analysis settings which you can use to debug code
7575
4. Settings for recommended extensions, ex. markdown and script formatting
7676
5. Spelling settings such as random good words which would be detected as misspelled.
@@ -111,33 +111,39 @@ Recommended extensions in workspace are as follows:
111111
Firewall rules can be exported into CSV file, this extension provides syntax highlighting for
112112
CSV files
113113

114-
8. [GitLens][extension gitlens]
115-
116-
It provides so many great features for git inside VSCode it can't be explained in one line
117-
118-
9. [Markdown All in One][extension markdown aio]
114+
8. [Markdown All in One][extension markdown aio]
119115

120116
Provides markdown language features
121117

122-
10. [XML Tools][extension xml]
118+
9. [XML Tools][extension xml]
123119

124120
Useful module xml files navigation
125121

126-
11. [Log File Highlighter][extension logs]
122+
10. [Log File Highlighter][extension logs]
127123

128124
Custom syntax highlighting for log files, useful for firewall logs as an alternative of mTail.
129125
This extension complements "Auto Scroll"
130126

131-
12. [Auto Scroll][extension scroll]
127+
11. [Auto Scroll][extension scroll]
132128

133129
Automatic scrolling of log files, useful to tail firewall logs.
134130
This extension complements "Log File Highlighter"
135131

136-
13. [Filter Line][extension filterline]
132+
12. [Filter Line][extension filterline]
137133

138134
Filter log files according to json config, string or regex pattern
139135

140-
The continuation of before mentioned link for PowerShell, gpg, ssh etc. is to visit `Config\ProjectSettings.ps1`
136+
Following 2 extensions are optional and will not be automatically offerred for installation:
137+
138+
- [GitLens][extension gitlens]
139+
140+
It provides so many great features for git inside VSCode it can't be explained in one line
141+
142+
- [GitHub Pull Requests and Issues][pull requests]
143+
144+
Review and manage your GitHub pull requests and issues directly in VS Code
145+
146+
The continuation of before mentioned tutorial for PowerShell, gpg, ssh etc. is to visit `Config\ProjectSettings.ps1`
141147
located in project root directory, at a minimum you should set following variables to `$true`
142148
before doing anything else:
143149

@@ -149,12 +155,12 @@ before doing anything else:
149155
6. WarningLogging
150156

151157
Note that some of these may be auto adjusted after setting `Develop` to `$true`\
152-
Then restart PowerShell and run `.\SetupFirewall.ps1` to apply firewall, or at least run
158+
Then restart PowerShell and run `.\SetupFirewall.ps1` to deploy firewall, or at least run
153159
`Initialize-Project` function which will prompt you to perform recommended and required checks.
154160

155161
Detailed description of variables is located in `Config\ProjectSettings.ps1`
156162

157-
After project was intialized `ProjectCheck` variable should be disabled, logging variables can be
163+
Once repository was intialized `ProjectCheck` variable should be disabled, logging variables can be
158164
disabled too.
159165

160166
If you don't have this environment setup, you'll have to do this some other way around for your
@@ -171,7 +177,7 @@ Lines should be kept within 100-120 columns, however it is not always practical,
171177
rule, workspace settings are configured to show rulers inside code editor.
172178

173179
If you use some other code editor you should configure it according to these rules which are found
174-
in `.vscode`, `Config` and project root directory.
180+
in `.vscode`, `Config` and repository root directory.
175181

176182
Not everything is automatically formatted, in short:\
177183
Use **PascalCase** for variables, types, symbols etc; **lowercase** for language keywords,
@@ -238,6 +244,8 @@ easily customized without too much change or learning curve.
238244
3rd party code/scripts are dot sourced into existing modules instead of copy pasted into module
239245
directly, this must be so, to easily see to which file does license/Copyright apply in full.
240246

247+
Exception to this rule are complete modules which should retain their directory domain within repository.
248+
241249
## Module design
242250

243251
Rules for code in modules is different, most important is to keep each function in it's own script,
@@ -273,7 +281,7 @@ Invoke-ScriptAnalyzer -Path .\ -Recurse -Settings Config\PSScriptAnalyzerSetting
273281

274282
If you get an error such as:\
275283
`Invoke-ScriptAnalyzer: Object reference not set to an instance of an object.`\
276-
then try again and keep repeating until OK.
284+
then try again and keep repeating until OK, or cleanup repository and restart VSCode.
277285

278286
## Documentation and comments
279287

@@ -282,11 +290,11 @@ Documentation and comments reside in 6 places as follows:
282290
1. In scripts (code comments)
283291

284292
Sections of code should be documented as shown in existing scripts.\
285-
To comment on things that need to be done add "TODO:" + comment,
286-
similarly for important notes add "NOTE:" + comment.
293+
To comment on things that need to be done add `TODO:` + comment,
294+
similarly for important notes add `NOTE:` + comment.
287295

288-
For things which are hard to resolve add "HACK:" + comment, and optionally some links such as
289-
github issues that may help to resolve problem in the future.
296+
For things which are hard to resolve or require huge changes add `HACK:` + comment, and
297+
optionally some links such as github issues that may help to resolve problem in the future.
290298

291299
For any generic code comments you might want to add, use line comments (preferred) and
292300
block comments only if comment spans 10 or more lines.
@@ -304,27 +312,29 @@ Documentation and comments reside in 6 places as follows:
304312

305313
Each of these prompts have `?` which the user can type to get more information about prompt choices.
306314

307-
4. In comment based help (module main documentation source)
315+
4. In comment based help (module and script main documentation source)
308316

309-
Functions that are part of a module must have comment based help.\
310-
Purpose of comment based help is for module user to be able to run `Get-Help` on target function.
317+
Functions that are part of a module or solo scripts must have comment based help.\
318+
Purpose of comment based help is for the end user to learn what the codes does or to be able to
319+
run `Get-Help` on target function or script.
311320

312-
For examples and comment based syntax see:
321+
For examples, and comment based syntax see:
313322
- [About Comment-based Help][about comment based help]
314323
- [Examples of Comment-Based Help][comment based help examples]
315324

316325
You must avoid following comment based content to avoid errors while generating online help files:
317326
- .LINK entries must contains only one link and nothing else
318327
- Avoid dashes in comments such as `------`
328+
- Avoid lines starting with a backslash `\` or any non alphanumeric character
319329

320330
5. In module Help folder (module online documentation)
321331

322-
The `Scripts` folder contains `UpdateHelp.ps1` which when run will scan comment based help and
323-
generate online documentation for `Get-Help -Online` and help content for `Update-Help` on
332+
The `Scripts` folder contains `UpdateHelp.ps1` which when run will scan comment based help and\
333+
generate online documentation for `Get-Help -Online` and help content for `Update-Help` on\
324334
target module.
325335

326-
Generated module documentation is of markdown format, meaning the 3rd purpose is that project
327-
users and repository visitors can read module documentation on github site.
336+
Generated module documentation is in markdown format, meaning the 3rd purpose is that project
337+
users and repository visitors can read module documentation on github site with `Get-Help -Online`
328338

329339
6. In Readme folder (general project documentation)
330340

@@ -347,19 +357,20 @@ no explanation what is this supposed to allow or block is not acceptable.
347357

348358
## Testing code
349359

350-
Each function should have it's own test script and each test should cover as much code/test
360+
Each function should have it's own unit test and each test should cover as much code/test
351361
cases as possible, making changes to exiting code can then be easily tested.\
352362
If test case/concept expands to several functions or if it's completely
353363
unrelated to functions it should be a separate test.
354364

355-
All tests reside in "Test" folder which contains subfolders for each module,
365+
All tests reside in `Test` directory which contains subdirectories for each module,
356366
take a look there for examples.
357367

358-
Pester is preferred method to write tests, however some testings needs other way around, or
368+
Pester is preferred method to write tests, however some test cases needs other ways around, or
359369
more specialized setup.
360370

361-
There is a module called "Ruleset.Test", which is customized for this project.\
362-
Tests must pass both Desktop and Core editions of PowerShell to be successful
371+
There is a module called `Ruleset.Test`, which is customized for this project.\
372+
Tests must pass both Desktop and Core editions of PowerShell on multiple Windows editions to be
373+
successful
363374

364375
A hint to quickly run any function from any project module is to run following command in ex.
365376
integrated terminal in VSCode (assuming PowerShell prompt is at project root):
@@ -375,44 +386,45 @@ This will add all repository `Modules` to current session module path
375386
Push small commits that solve or improve single or specific problem,
376387
to reduce merge conflicts and to be able to do `git revert` for specific stuff.
377388

378-
Do not wait too much to push large commits which are not clear enough in terms
389+
Do not wait too much to push large commits which are then not clear enough in terms
379390
of what issue is supposed to be resolved or which component was improved.
380391

381-
If you see something unrelated that could be resolved, put TODO commont, don't fix it.\
382-
Then once you commit open todo-tree to review what to do next.
392+
If you see something unrelated that could be resolved, put `TODO` comment, don't fix it.\
393+
Then once you commit, open `todo-tree` to review what to do next.
383394

384-
**Avoid making huge changes to existing code** without first discussing the matter,
395+
**Please avoid making huge changes to existing code** without first attaching valid reasons,
385396
new code and additions is not problem though.
386397

387398
## Portability and other systems
388399

389-
At the moment the focus is on Windows Firewall, if you want to port code to other firewalls go ahead.
400+
At the moment the focus is on Windows Firewall, if you want to extend code base to other firewalls
401+
go ahead, it surely won't be easy!
390402

391-
If you decide to port code it is mandatory that these code changes are done on separate branch.
403+
If you decide to do so it is mandatory that these code additions are done on separate branch, which
404+
should then be regularly maintained for any changes on master branch, up until you are done.
392405

393-
The plan is to expand this project to manage [nftables][nftables]
394-
firewall on linux and other systems.
406+
The plan is to expand this project to manage [nftables][nftables] firewall on linux and other systems.
395407

396408
## Making new scripts or modules
397409

398410
Inside `Templates` folder there are few template scripts as a starting point.\
399-
Copy them to target location, update starting code and you're ready to start writing.
411+
Copy them to target location, update starting code and you're ready to start working.
400412

401413
These templates are fully aligned to rule design, code and formatting style of this project.
402414

403415
## Repository folder structure
404416

405417
See [Directory Structure](Readme/DirectoryStructure.md)
406418

407-
## Final notes and where to start
419+
## Where to start
408420

409-
Please keep in mind that large amount of existing code is not in line with all the guidelines
410-
described here, significant portion of code was written before this "CONTRIBUTING" file even existed.
421+
Please keep in mind that large amount of existing code is not in line with all the guidelines described
422+
here, significant portion of the code was written before this `CONTRIBUTING.md` file even existed.
411423

412424
So it's an ongoing effort that by no means gets fulfilled.
413425

414-
I recommend you start at looking into [TODO](Readme/TODO.md) list and also use "todo-tree"
415-
extension to see even more todo's, unless you have specific ideas or recommendations.
426+
I recommend you start at looking into [TODO](Readme/TODO.md) list and also use `todo-tree`
427+
extension to see more specific or smaller todo's, unless you have specific ideas or recommendations.
416428

417429
[contributing develop]: https://github.com/metablaster/WindowsFirewallRuleset/blob/develop/CONTRIBUTING.md "latest CONTRIBUTING.md"
418430
[contribute to open source]: https://opensource.guide/how-to-contribute "How to contribute to open source"
@@ -448,3 +460,4 @@ extension to see even more todo's, unless you have specific ideas or recommendat
448460
[comment based help examples]: https://docs.microsoft.com/en-us/powershell/scripting/developer/help/examples-of-comment-based-help?view=powershell-7 "Visit documentation"
449461
[iana]: https://www.iana.org "Internet Assigned Numbers Authority (IANA)"
450462
[nftables]: https://en.wikipedia.org/wiki/Nftables "Visit nftables wiki"
463+
[pull requests]: https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github "Visit Marketplace"

0 commit comments

Comments
 (0)