From 8fe48f1ce879095d5a9e2fb6fcad590d9870c4c2 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Mon, 15 Jan 2024 22:44:55 -0500 Subject: [PATCH 01/12] [#227] Add installation instruction info --- README.md | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 75cd455..0e7bdbe 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,37 @@ Read [_PDD in Action_](http://www.yegor256.com/2017/04/05/pdd-in-action.html) and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ). -You should have [Ruby installed](https://www.ruby-lang.org/en/documentation/installation/). +## Installation +
+ +### Prerequisites: `Ruby installed` and `Libmagic` + +
+ +#### Ruby version 2.7+ + +[Ruby installation instruction](https://www.ruby-lang.org/en/documentation/installation/) +
+
+ + +#### Libmagic library + + +**For \*nix** +```bash +$ apt install libmagic-dev +``` +**For Mac** +```bash +$ brew install libmagic +``` +**For Windows** +Unfortunately, there is no easy way to install, please use WSL + +
+
+ Then, install our gem: ```bash @@ -38,9 +68,10 @@ Run it locally and read its output: $ pdd --help ``` +## Usage You can exclude & include certain number of files from the search via these options: -``` +```bash $ pdd --exclude=glob ``` @@ -55,7 +86,7 @@ $ pdd --exclude=src/**/* # exclude all files in src/ You can include too: -``` +```bash $ pdd --include=glob ``` @@ -80,9 +111,9 @@ to the leading space in every consecutive line): [related code] ``` -`[]` - Replace with apropriate data (see text enclosed in brackets) +`[]` - Replace with appropriate data (see text enclosed in brackets) -`<>` - Omitable (enclosed data can be left out) +`<>` - Optional (enclosed data can be left out) Example: @@ -142,7 +173,7 @@ and put a dummy `#1` marker everywhere. You can specify post-parsing rules for your puzzles, in command line, for example: -``` +```bash $ pdd --rule=min-estimate:60 --rule=max-estimate:120 ``` @@ -217,13 +248,13 @@ Make sure your build is green before you contribute your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and [Bundler](https://bundler.io/) installed. Then: -``` +```bash $ bundle install $ bundle exec rake ``` Next, install and run overcommit to install hooks (required once) -``` +```bash $ gem install overcommit -v '=0.58.0' $ overcommit --install ``` From 4ff7b47440c9241a931ee806c379d5eb27bdfe67 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Tue, 16 Jan 2024 23:49:12 -0500 Subject: [PATCH 02/12] [#205] Add description for all parameters --- README.md | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0e7bdbe..521705b 100644 --- a/README.md +++ b/README.md @@ -72,22 +72,22 @@ $ pdd --help You can exclude & include certain number of files from the search via these options: ```bash -$ pdd --exclude=glob +$ pdd --exclude glob ``` You can skip any file(s) with a name suffix that matches the pattern glob, using wildcard matching; a name suffix is either the whole path and name, or reg expr, for example: ```bash -$ pdd --exclude=src/**/*.java --exclude=target/**/* -$ pdd --exclude=src/**/*.java # exclude .java files in src/ -$ pdd --exclude=src/**/* # exclude all files in src/ +$ pdd --exclude src/**/*.java --exclude target/**/* +$ pdd --exclude src/**/*.java # exclude .java files in src/ +$ pdd --exclude src/**/* # exclude all files in src/ ``` You can include too: ```bash -$ pdd --include=glob +$ pdd --include glob ``` Search only files whose name matches glob, using wildcard matching as described under ``--exclude``. @@ -95,10 +95,33 @@ If contradictory ``--include`` and ``--exclude`` options are given, the last mat If no ``--include`` or ``--exclude`` options are given, all files from working directory are included, example: ```bash -$ pdd --include=src/**/*.py # include only .py files in src/ -$ pdd --include=src/**/* # include all files in src/ +$ pdd --include src/**/*.py # include only .py files in src/ +$ pdd --include src/**/* # include all files in src/ ``` +Full command format is (all parameters are optional): +```bash +$ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ + [--source ] [--file puzzles_file.xml] [--include src/**/*.py] \ + [--format xml|html] [--rule min-words:5] [--exclude src/**/*.java] +``` +| Parameter | Description | +|-----------------------------|---------------------------------------------------------------------------------------| +| --verbose | Enable verbose (debug) mode. --file must be used in case of using | +| --quiet | Disable logs | +| --remove | Remove all found puzzles from the source code | +| --skip-gitignore | Don't look into .gitignore for excludes | +| --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | +| --source | Source directory to parse ("." by default) | +| --file puzzles_file.xml | File to save report into into (xml of html) (displayed in console by default) | +| --include src/**/*.py | Glob pattern to exclude, e.g. src/**/*.py (can be used several times) | +| --exclude src/**/*.java | Glob pattern to include, e.g. src/**/*.java (can be used several times) | +| --format xml | Format of the report xml or html (xml is default) | +| --rule min-words:5 | Rule to apply (can be used several times), described later | + +:bulb: There is an option to create a .pdd file in your project and save all required parameters in it. +File example you can see in this project. + ## How to Format? Every puzzle has to be formatted like this (pay attention @@ -174,7 +197,7 @@ You can specify post-parsing rules for your puzzles, in command line, for example: ```bash -$ pdd --rule=min-estimate:60 --rule=max-estimate:120 +$ pdd --rule min-estimate:60 --rule max-estimate:120 ``` These two parameters will add two post-parsing rules `min-estimate` @@ -198,7 +221,7 @@ Here is a list of rules available now: This rule is used by default and you can't configure it at the moment, it must always be set to `1`. -You can put all command line options into `.pdd` file. The options from the +:bulb: You can put all command line options into `.pdd` file. The options from the file will be used first. Command line options may be added on top of them. See, how it is done in [yegor256/0pdd](https://github.com/yegor256/0pdd/blob/master/.pdd). From 34a35bf303a89fe7b29ef17e0294083f9612e9d7 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Tue, 16 Jan 2024 23:59:54 -0500 Subject: [PATCH 03/12] [#227] Add a space to display the link --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0e7bdbe..c3e2039 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ). #### Ruby version 2.7+ + [Ruby installation instruction](https://www.ruby-lang.org/en/documentation/installation/)
From 8a80a192c350a7ea1904976265351b502c9b25df Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 00:18:07 -0500 Subject: [PATCH 04/12] [#227] Fix Codacy error --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index bf4a652..ebe5c3a 100644 --- a/README.md +++ b/README.md @@ -106,19 +106,19 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ [--source ] [--file puzzles_file.xml] [--include src/**/*.py] \ [--format xml|html] [--rule min-words:5] [--exclude src/**/*.java] ``` -| Parameter | Description | -|-----------------------------|---------------------------------------------------------------------------------------| -| --verbose | Enable verbose (debug) mode. --file must be used in case of using | -| --quiet | Disable logs | -| --remove | Remove all found puzzles from the source code | -| --skip-gitignore | Don't look into .gitignore for excludes | -| --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | -| --source | Source directory to parse ("." by default) | -| --file puzzles_file.xml | File to save report into into (xml of html) (displayed in console by default) | -| --include src/**/*.py | Glob pattern to exclude, e.g. src/**/*.py (can be used several times) | -| --exclude src/**/*.java | Glob pattern to include, e.g. src/**/*.java (can be used several times) | -| --format xml | Format of the report xml or html (xml is default) | -| --rule min-words:5 | Rule to apply (can be used several times), described later | +| Parameter | Description | +|-------------------------|---------------------------------------------------------------------------------------| +| --verbose | Enable verbose (debug) mode. --file must be used in case of using | +| --quiet | Disable logs | +| --remove | Remove all found puzzles from the source code | +| --skip-gitignore | Don't look into .gitignore for excludes | +| --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | +| --source | Source directory to parse ("." by default) | +| --file puzzles.xml | File to save report into into (xml of html) (displayed in console by default) | +| --include src/*.py | Glob pattern to exclude, e.g. src/*.py (can be used several times) | +| --exclude src/*.java | Glob pattern to include, e.g. src/*.java (can be used several times) | +| --format xml | Format of the report xml or html (xml is default) | +| --rule min-words:5 | Rule to apply (can be used several times), described later | :bulb: There is an option to create a .pdd file in your project and save all required parameters in it. File example you can see in this project. From 3ecdcfbabe6356e797ed4d4b9fc09a664e8c427a Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 00:24:41 -0500 Subject: [PATCH 05/12] [#227] Fix Codacy error --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebe5c3a..a791ea6 100644 --- a/README.md +++ b/README.md @@ -115,8 +115,8 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | | --source | Source directory to parse ("." by default) | | --file puzzles.xml | File to save report into into (xml of html) (displayed in console by default) | -| --include src/*.py | Glob pattern to exclude, e.g. src/*.py (can be used several times) | -| --exclude src/*.java | Glob pattern to include, e.g. src/*.java (can be used several times) | +| --include src/*.py | Glob pattern to exclude (can be used several times) | +| --exclude src/*.java | Glob pattern to include (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | | --rule min-words:5 | Rule to apply (can be used several times), described later | From 8397d5f50802156fcdf59e8a0a244d37c04b78ab Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 00:28:25 -0500 Subject: [PATCH 06/12] [#227] Fix Codacy error --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a791ea6..7729422 100644 --- a/README.md +++ b/README.md @@ -115,8 +115,8 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | | --source | Source directory to parse ("." by default) | | --file puzzles.xml | File to save report into into (xml of html) (displayed in console by default) | -| --include src/*.py | Glob pattern to exclude (can be used several times) | -| --exclude src/*.java | Glob pattern to include (can be used several times) | +| --include *.py | Glob pattern to exclude (can be used several times) | +| --exclude *.java | Glob pattern to include (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | | --rule min-words:5 | Rule to apply (can be used several times), described later | From 2877165b2145bcdaed070ccf318a75c2025b6013 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 00:36:06 -0500 Subject: [PATCH 07/12] [#227] Fix for Ruby version and os names --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c3e2039..3e49ee1 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ). #### Libmagic library -**For \*nix** +**For Debian/Ubuntu/\*nix/\*nux** ```bash $ apt install libmagic-dev ``` @@ -246,7 +246,7 @@ The most interesting parts of each puzzle are: Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html). Make sure your build is green before you contribute -your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.3+ and +your pull request. You will need to have [Ruby](https://www.ruby-lang.org/en/) 2.7+ and [Bundler](https://bundler.io/) installed. Then: ```bash From 3a9ff176561e6dce7d152a5f591756566f7eb4a6 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 09:33:36 -0500 Subject: [PATCH 08/12] Update README.md Co-authored-by: Slava Semushin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 371cde4..4aa3edf 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ | --skip-gitignore | Don't look into .gitignore for excludes | | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | | --source | Source directory to parse ("." by default) | -| --file puzzles.xml | File to save report into into (xml of html) (displayed in console by default) | +| --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) | | --include *.py | Glob pattern to exclude (can be used several times) | | --exclude *.java | Glob pattern to include (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | From 29e2914bb7f2c99a726b86febdd2165a42749559 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 09:33:48 -0500 Subject: [PATCH 09/12] Update README.md Co-authored-by: Slava Semushin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4aa3edf..a901642 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ | --source | Source directory to parse ("." by default) | | --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) | | --include *.py | Glob pattern to exclude (can be used several times) | -| --exclude *.java | Glob pattern to include (can be used several times) | +| --exclude *.java | Glob pattern to exclude (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | | --rule min-words:5 | Rule to apply (can be used several times), described later | From e778184509a67fc5a57fb6271141cb7dea2a55ce Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 10:21:18 -0500 Subject: [PATCH 10/12] [#205] Fix verbose option description --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a901642..77def13 100644 --- a/README.md +++ b/README.md @@ -108,13 +108,13 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ ``` | Parameter | Description | |-------------------------|---------------------------------------------------------------------------------------| -| --verbose | Enable verbose (debug) mode. --file must be used in case of using | +| --verbose | Enable verbose (debug) mode. --file must be used in case of using this option | | --quiet | Disable logs | | --remove | Remove all found puzzles from the source code | | --skip-gitignore | Don't look into .gitignore for excludes | | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | | --source | Source directory to parse ("." by default) | -| --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) | +| --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) | | --include *.py | Glob pattern to exclude (can be used several times) | | --exclude *.java | Glob pattern to exclude (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | From ebcc9deb8c501a6f53c8ea44fe9eb669f0506f09 Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 10:22:51 -0500 Subject: [PATCH 11/12] Update README.md Co-authored-by: Slava Semushin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 77def13..e8d2256 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ $ pdd [--verbose] [--quiet] [--remove] [--skip-gitignore] [--skip-errors] \ | --skip-errors | Suppress error as warning and skip badly formatted puzzles (do not skip broken rules) | | --source | Source directory to parse ("." by default) | | --file puzzles.xml | File to save report into (xml of html) (displayed in console by default) | -| --include *.py | Glob pattern to exclude (can be used several times) | +| --include *.py | Glob pattern to include (can be used several times) | | --exclude *.java | Glob pattern to exclude (can be used several times) | | --format xml | Format of the report xml or html (xml is default) | | --rule min-words:5 | Rule to apply (can be used several times), described later | From 98876b61a6aeac9b22309251b06e39fdb26d329a Mon Sep 17 00:00:00 2001 From: Natalia Pozhidaeva Date: Wed, 17 Jan 2024 10:58:33 -0500 Subject: [PATCH 12/12] Update README.md Co-authored-by: Slava Semushin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e49ee1..bad939c 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ and watch [this webinar](https://www.youtube.com/watch?v=nsYGC2aUwfQ). #### Libmagic library -**For Debian/Ubuntu/\*nix/\*nux** +**For Debian/Ubuntu:** ```bash $ apt install libmagic-dev ```