From 179208cf3097e13246ec2d67207d0153a626d5ef Mon Sep 17 00:00:00 2001 From: Manuel Barkhau Date: Sat, 3 Oct 2020 20:03:59 +0000 Subject: [PATCH] doc updates --- CHANGELOG.md | 5 ++++- README.md | 15 +++++++------ pylint-ignore.md | 47 +++++++++++++--------------------------- src/pycalver/__main__.py | 18 +++++++-------- 4 files changed, 36 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4643202..7d45e90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,12 +8,15 @@ - Better support for optional parts. - New: Start `BUILD` parts at `1000` to avoid leading zero truncation. - New gitlab #2: Added `grep` subcommand to find and debug patterns. + - New: Added better error messages to debug regular expressions. - New gitlab #10: `--pin-date` to keep date parts unchanged, and only increment non-date parts. - - New add `--release-num` to increment the `alphaN`/`betaN`/`a0`/`b0`/etc. release number + - New: Added `--release-num` to increment the `alphaN`/`betaN`/`a0`/`b0`/etc. release number + - New: Added `--date=` parameter to set explicit date (instead of current date). - Fix gitlab #8: Push tags only pushed tags, not actual commit. - Fix gitlab #9: Make commit message configurable. - Fix gitlab #11: Show regexp when `--verbose` is used. - Fix: Disallow `--release=dev` which has different semantics than other release tags. + - Fix: Entries in `file_patterns` were ignored if there were multiple for the same file. - Switch main repo from gitlab to github. diff --git a/README.md b/README.md index d89a18f..c780a0c 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ $ cd myproject ~/myproject/ $ pycalver init --dry WARNING - File not found: pycalver.toml -Exiting because of '--dry'. Would have written to pycalver.toml: +Exiting because of '-d/--dry'. Would have written to pycalver.toml: [pycalver] current_version = "v202010.1001-alpha" @@ -541,7 +541,7 @@ The steps performed by `bump` are: 5. *Tag* the new commit. 6. *Push* the new commit and tag. -Again, you can use `--dry` to inspect the changes first. +Again, you can use `-d/--dry` to inspect the changes first. ``` $ pycalver bump --dry @@ -597,12 +597,13 @@ TODO: Descriptions | CLI Argument | Description | |------------------|-------------| | --major | | -| -m --minor | | -| -p --patch | | -| -r --release-num | | +| -m/--minor | | +| -p/--patch | | +| -r/--release-num | | +| --date | | | --pin-date | | -| --no-fetch | | -| --dry | | +| -n/--no-fetch | | +| -d/--dry | | | --allow-dirty | | diff --git a/pylint-ignore.md b/pylint-ignore.md index e0098a1..c20c367 100644 --- a/pylint-ignore.md +++ b/pylint-ignore.md @@ -63,37 +63,20 @@ The recommended approach to using `pylint-ignore` is: ``` -## File src/pycalver/config.py - Line 275 - W0511 (fixme) - -- `message: TODO (mb 2020-09-18): Validate Pattern` -- `author : Manuel Barkhau ` -- `date : 2020-09-18T19:04:06` - -``` - 251: def _parse_config(raw_cfg: RawConfig) -> Config: - ... - 273: raise ValueError(f"Invalid week number pattern: {version_pattern}") - 274: -> 275: # TODO (mb 2020-09-18): Validate Pattern - 276: # detect YY with WW or UU -> suggest GG with VV - 277: # detect YYMM -> suggest YY0M -``` - - -## File src/pycalver/__main__.py - Line 317 - W0511 (fixme) +## File src/pycalver/__main__.py - Line 419 - W0511 (fixme) - `message: TODO (mb 2020-09-18): Investigate error messages` - `author : Manuel Barkhau ` - `date : 2020-09-19T16:24:10` ``` - 287: def _bump( + 389: def _bump( ... - 315: sys.exit(1) - 316: except Exception as ex: -> 317: # TODO (mb 2020-09-18): Investigate error messages - 318: logger.error(str(ex)) - 319: sys.exit(1) + 417: sys.exit(1) + 418: except Exception as ex: +> 419: # TODO (mb 2020-09-18): Investigate error messages + 420: logger.error(str(ex)) + 421: sys.exit(1) ``` @@ -101,7 +84,7 @@ The recommended approach to using `pylint-ignore` is: - `message: TODO (mb 2020-09-20): New Rollover Behaviour:` - `author : Manuel Barkhau ` -- `date : 2020-09-20T17:36:38` +- `date : 2020-10-03T19:31:28` ``` 599: def incr( @@ -116,20 +99,20 @@ The recommended approach to using `pylint-ignore` is: # W0703: broad-except -## File src/pycalver/__main__.py - Line 316 - W0703 (broad-except) +## File src/pycalver/__main__.py - Line 418 - W0703 (broad-except) - `message: Catching too general exception Exception` - `author : Manuel Barkhau ` - `date : 2020-09-05T14:30:17` ``` - 287: def _bump( + 389: def _bump( ... - 314: logger.error(str(ex)) - 315: sys.exit(1) -> 316: except Exception as ex: - 317: # TODO (mb 2020-09-18): Investigate error messages - 318: logger.error(str(ex)) + 416: logger.error(str(ex)) + 417: sys.exit(1) +> 418: except Exception as ex: + 419: # TODO (mb 2020-09-18): Investigate error messages + 420: logger.error(str(ex)) ``` diff --git a/src/pycalver/__main__.py b/src/pycalver/__main__.py index 54204ad..d7b3083 100755 --- a/src/pycalver/__main__.py +++ b/src/pycalver/__main__.py @@ -133,11 +133,10 @@ def cli(verbose: int = 0) -> None: @click.option("-r" , "--release-num", is_flag=True, default=False, help="Increment release number.") @click.option("--pin-date", is_flag=True, default=False, help="Leave date components unchanged.") @click.option( - "-d", "--date", default=None, - metavar="", - help=f"Set explicit date in format YYYY-0M-0D (eg. {_current_date}).", + metavar="", + help=f"Set explicit date in format YYYY-0M-0D\n(eg. {_current_date}).", ) def test( old_version: str, @@ -212,10 +211,11 @@ def _grep_text(pattern: patterns.Pattern, text: str, color: bool) -> int: else: lines[1] = matched_line + print() + for i, line in enumerate(lines): print(f"{lines_offset + i:>4}: {line}") - print() return match_count @@ -444,7 +444,7 @@ def _try_bump( @cli.command() @click.option('-v', '--verbose', count=True, help="Control log level. -vv for debug level.") @click.option( - "--dry", default=False, is_flag=True, help="Display diff of changes, don't rewrite files." + '-d', "--dry", default=False, is_flag=True, help="Display diff of changes, don't rewrite files." ) def init(verbose: int = 0, dry: bool = False) -> None: """Initialize [pycalver] configuration.""" @@ -457,7 +457,7 @@ def init(verbose: int = 0, dry: bool = False) -> None: sys.exit(1) if dry: - click.echo(f"Exiting because of '--dry'. Would have written to {ctx.config_rel_path}:") + click.echo(f"Exiting because of '-d/--dry'. Would have written to {ctx.config_rel_path}:") cfg_text: str = config.default_config(ctx) click.echo("\n " + "\n ".join(cfg_text.splitlines())) sys.exit(0) @@ -489,6 +489,7 @@ def _update_cfg_from_vcs(cfg: config.Config, fetch: bool) -> config.Config: help="Sync tags from remote origin.", ) @click.option( + "-d", "--dry", default=False, is_flag=True, @@ -519,11 +520,10 @@ def _update_cfg_from_vcs(cfg: config.Config, fetch: bool) -> config.Config: @click.option("-r", "--release-num", is_flag=True, default=False, help="Increment release number.") @click.option("--pin-date", is_flag=True, default=False, help="Leave date components unchanged.") @click.option( - "-d", "--date", default=None, - metavar="", - help=f"Set explicit date in format YYYY-0M-0D (eg. {_current_date}).", + metavar="", + help=f"Set explicit date in format YYYY-0M-0D\n(eg. {_current_date}).", ) def bump( release : typ.Optional[str] = None,