Skip to content

Commit

Permalink
chore: remove spaces before column everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
oknozor committed Nov 30, 2021
1 parent 3d8db7d commit 3f21a55
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 73 deletions.
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ to provide what you would expect from such tools plus some original features.
- Make using the conventional commit spec easy and fun.
- Enable people to focus on their work instead of correcting small mistakes and typo.
- Correctness regarding semver and conventional commit.
- Automate things when possible (ex : bumping versions).
- Automate things when possible (ex: bumping versions).

### Non goals

Expand Down Expand Up @@ -65,7 +65,7 @@ features related to the conventional commit specification. Anything else shall b

### Cargo

Cocogitto is available on [crates.io](https://crates.io/crates/cocogitto) :
Cocogitto is available on [crates.io](https://crates.io/crates/cocogitto):

```
cargo install cocogitto
Expand All @@ -86,7 +86,7 @@ All configuration values are optional, take a look at [cog.toml](cog.toml) to kn
At the moment Cocogitto comes with two binaries `coco` and `cog`.

- `coco` is used to create commits respecting the conventional commit spec.
- `cog` does everything else : check your
- `cog` does everything else: check your
repo history against the spec, edit malformed commit messages, generate changelog and bump versions etc.

### Shell completions
Expand Down Expand Up @@ -118,9 +118,9 @@ $ coco generate-completions zsh > ~/.zfunc/_coco
## Coco Commits

`coco` allows you to easily create commits respecting the conventional specification. It comes with a set of predefined arguments
named after conventional commit types : `style`, `build`, `refactor`, `ci`, `fix`, `test`, `perf`, `chore`, `feat`, `revert`, `docs`.
named after conventional commit types: `style`, `build`, `refactor`, `ci`, `fix`, `test`, `perf`, `chore`, `feat`, `revert`, `docs`.

Conventional commits are structured as follow :
Conventional commits are structured as follows:

```
<type>[optional scope]: <description>
Expand All @@ -130,7 +130,7 @@ Conventional commits are structured as follow :
[optional footer(s)]
```

All `coco` commit commands follows the same structure :
All `coco` commit commands follows the same structure:

```
coco {type} {message} [optional scope] [optional body] [optional footer]
Expand All @@ -139,22 +139,22 @@ coco {type} {message} [optional scope] [optional body] [optional footer]
The only difference you need to remember is that `coco` commit scope comes after the commit description. This allows
using positional arguments instead of typing flags (ex: `coco -t {type} -s {scope} -m {message}... and so on`)

For instance if you want to create the following commit : `feat: add awesome feature` you would run this :
For instance if you want to create the following commit: `feat: add awesome feature` you would run this :

```shell script
coco feat "add awesome feature"
```

### Breaking changes

All `coco` argument are positional except the optional `-B` flag used to create breaking changes commits :
All `coco` argument are positional except the optional `-B` flag used to create breaking changes commits:

```shell script
coco fix -B "add fix a nasty bug" cli
```

This would create the following [breaking change](https://www.conventionalcommits.org/en/v1.0.0/#commit-message-with--to-draw-attention-to-breaking-change)
commit : `fix!: fix a nasty bug`.
commit:`fix!: fix a nasty bug`.

`coco` use the `!` notation to denote breaking changes commit because it can be easily seen in your git log, however if
you manually create breaking changes commits with [the footer notation](https://www.conventionalcommits.org/en/v1.0.0/#commit-message-with-description-and-breaking-change-footer)
Expand All @@ -163,7 +163,7 @@ cocogitto tools will still pick them.

## Cog commands

The `cog` binary is used for everything that is not commit the available commands are the following :
The `cog` binary is used for everything that is not commit the available commands are the following:

| Command | Description | Required flags |
| :--- | :---- |:--- |
Expand All @@ -188,7 +188,7 @@ cog init
```

`cog init` works like `git init` except it create a template `cog.toml` config file,
and a default init commit with the following message : `chore: initial commit`.
and a default init commit with the following message:`chore: initial commit`.

Optionally you can specify the path of the repository you want to create :

Expand All @@ -215,14 +215,14 @@ Changes to be committed:

### Check commit history

Running `cog check` will check your commit history against the conventional commit specification :
Running `cog check` will check your commit history against the conventional commit specification:

```
❯ cog check
No errored commits
```

Let us create an invalid commit :
Let us create an invalid commit:
```shell script
git commit -m "Your Mother Was A Hamster, And Your Father Smelt Of Elderberries"
```
Expand All @@ -231,7 +231,7 @@ And check our commit history again :
```
❯ cog check
ERROR - Your Mother Was A Hamster, And Your Father Smelt Of Elderberries - (c82c30)
cause: invalid commit format : missing `: ` separator
cause: invalid commit format:missing `: ` separator
```

Additionally, you can check your history, starting from the latest tag to HEAD using `from-latest-tag` flag.
Expand All @@ -254,21 +254,21 @@ commit type etc.

You can also filter the log content with the following flags (`cog log --help`) :

- `-B` : display breaking changes only
- `-t` : filter on commit type
- `-a` : filter on commit author
- `-s` : filter on commit scope
- `-e` : ignore errors
- `-B`:display breaking changes only
- `-t`:filter on commit type
- `-a`:filter on commit author
- `-s`:filter on commit scope
- `-e`:ignore errors

Those flag can be combined to achieve complex search in your commit history :
Those flag can be combined to achieve complex search in your commit history:

```shell script
cog log --author "Paul Delafosse" "Mike Lubinets" --type feat --scope cli --no-error
```

### Generate changelogs

There are two way to generate changelog with `cog` :
There are two way to generate changelog with `cog`:
- To stdout with `cog changelog`.

```
Expand Down Expand Up @@ -296,7 +296,7 @@ There are two way to generate changelog with `cog` :

### Auto bump

Assuming we are working on the following git repository :
Assuming we are working on the following git repository:
```
* (HEAD -> master) feat: another cool feature
* docs: add some documentation
Expand All @@ -305,17 +305,17 @@ Assuming we are working on the following git repository :
* chore: initial commit
```

Let us now create a version :
Let us now create a version:
```
❯ cog bump --auto
Found feature commit caef0f, bumping to 0.1.0
Skipping irrelevant commit 025cc0 with type : docs
Skipping irrelevant commit 025cc0 with type:docs
Found bug fix commit e2af66, bumping to 0.1.1
Found feature commit 1b87aa, bumping to 0.2.0
Bumped version : 0.0.0 -> 0.2.0
Bumped version:0.0.0 -> 0.2.0
```

If we look again at our git log :
If we look again at our git log:
```
(HEAD -> master, tag: 0.2.0) chore(version): 0.2.0
...
Expand Down Expand Up @@ -354,24 +354,24 @@ caef0f - another cool feature - Paul Delafosse
This changelog was generated by [cocogitto](https://github.com/oknozor/cocogitto).
```

You need to run `cog bump` with one of the following flags :
- `--auto` : choose the next version for you (based on feature commit, bug fixes commit and BREAKING_CHANGE commit).
- `--major` : increment the MAJOR version.
- `--minor` : increment the MINOR version.
- `--patch` : increment the PATCH version.
- `--version <version>` : set version manually (ex : `cog bump --version 3.2.1`).
You need to run `cog bump` with one of the following flags:
- `--auto`:choose the next version for you (based on feature commit, bug fixes commit and BREAKING_CHANGE commit).
- `--major`:increment the MAJOR version.
- `--minor`:increment the MINOR version.
- `--patch`:increment the PATCH version.
- `--version <version>`:set version manually (ex:`cog bump --version 3.2.1`).

You can also create pre-release version by adding the `--pre` flag to the bump command :

```shell script
cog bump --major --pre "beta.1"
```

Coming from `1.2.3` this would create the following tag : `2.0.0-beta.0`.
Coming from `1.2.3` this would create the following tag:`2.0.0-beta.0`.


If you create a new version, the version changelog will be prepended to your changelog file separated by `- - -`.
Note that if your project already contains a changelog you can tell `cog` about it by adding this to the file :
Note that if your project already contains a changelog you can tell `cog` about it by adding this to the file:

```markdown
- - -
Expand Down Expand Up @@ -436,7 +436,7 @@ post_bump_hooks = [
]
```

As you can see we are bumping the manifest using a small DSL. It as only a few keywords :
As you can see we are bumping the manifest using a small DSL. It as only a few keywords:
- start with the `version` keyword.
- followed by the `+` operator.
- `major`, `minor` and `patch` to specify the kind of increment you want.
Expand All @@ -449,12 +449,12 @@ As you can see we are bumping the manifest using a small DSL. It as only a few k
To protect your commit history, and your git remote, cog have builtins
[git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks).

You can install them all by running :
You can install them all by running:
```
cog install-hook all
```

Or one by one, specifying the hook name :
Or one by one, specifying the hook name:

1. Pre-push hook

Expand Down
2 changes: 1 addition & 1 deletion src/conventional/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Commit {
let git2_message = message.unwrap().to_owned();
let author = commit.author().name().unwrap_or("").to_string();

// FIXME : Why suddenly commit message start and finish with '\n'
// FIXME:Why suddenly commit message start and finish with '\n'
let message = git2_message.trim_end().trim_start();
let conventional_commit = conventional_commit_parser::parse(message);

Expand Down
4 changes: 2 additions & 2 deletions src/conventional/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ impl VersionIncrement {
println!("Found bug fix commit {}", commit.shorthand().blue(),)
}
(commit_type, true) => println!(
"Found {} commit {} with type : {}",
"Found {} commit {} with type:{}",
"BREAKING CHANGE".red(),
commit.shorthand().blue(),
commit_type.as_ref().yellow()
),
(_, false) => println!(
"Skipping irrelevant commit {} with type : {}",
"Skipping irrelevant commit {} with type:{}",
commit.shorthand().blue(),
commit.message.commit_type.as_ref().yellow()
),
Expand Down
12 changes: 6 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ impl Display for CocogittoError {
author,
cause,
} => {
let error_header = "Errored commit : ".bold().red();
let error_header = "Errored commit:".bold().red();
let author = format!("<{}>", author).blue();
writeln!(
f,
"{header}{oid} {author}\n\t{message_title}'{summary}'\n\t{cause_title}{cause}",
header = error_header,
oid = oid,
author = author,
message_title = "Commit message : ".yellow().bold(),
message_title = "Commit message:".yellow().bold(),
summary = summary.italic(),
cause_title = "Cause : ".yellow().bold(),
cause_title = "Cause:".yellow().bold(),
cause = cause
)
}
Expand All @@ -60,16 +60,16 @@ impl Display for CocogittoError {
oid,
author,
} => {
let error_header = "Errored commit : ".bold().red();
let error_header = "Errored commit:".bold().red();
let author = format!("<{}>", author).blue();
writeln!(
f,
"{header}{oid} {author}\n\t{message}'{summary}'\n\t{cause}Commit type `{commit_type}` not allowed",
header = error_header,
oid = oid,
author = author,
message = "Commit message : ".yellow().bold(),
cause = "Cause : ".yellow().bold(),
message = "Commit message:".yellow().bold(),
cause = "Cause:".yellow().bold(),
summary = summary.italic(),
commit_type = commit_type.red()
)
Expand Down
8 changes: 4 additions & 4 deletions src/git/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ impl Repository {
Ok(head) => head
.peel_to_commit()
.map_err(|err| anyhow!("Could not peel head to commit {}", err)),
Err(err) => Err(anyhow!("Repo as not HEAD : {}", err)),
Err(err) => Err(anyhow!("Repo as not HEAD:{}", err)),
}
}

pub(crate) fn resolve_lightweight_tag(&self, tag: &str) -> Result<Oid> {
self.0
.resolve_reference_from_short_name(tag)
.map(|reference| reference.target().unwrap())
.map_err(|err| anyhow!("Cannot resolve tag {} : {}", tag, err.message()))
.map_err(|err| anyhow!("Cannot resolve tag {}:{}", tag, err.message()))
}

pub(crate) fn get_latest_tag(&self) -> Result<String> {
Expand Down Expand Up @@ -166,7 +166,7 @@ impl Repository {
pub(crate) fn get_latest_tag_oid(&self) -> Result<Oid> {
self.get_latest_tag()
.and_then(|tag| self.resolve_lightweight_tag(&tag))
.map_err(|err| anyhow!("Could not resolve latest tag : {}", err))
.map_err(|err| anyhow!("Could not resolve latest tag:{}", err))
}

pub(crate) fn get_latest_tag_oidof(&self) -> Result<OidOf> {
Expand All @@ -175,7 +175,7 @@ impl Repository {
self.resolve_lightweight_tag(&tag)
.map(|oid| OidOf::Tag(tag, oid))
})
.map_err(|err| anyhow!("Could not resolve latest tag : {}", err))
.map_err(|err| anyhow!("Could not resolve latest tag:{}", err))
}

pub(crate) fn get_first_commit_oidof(&self) -> Result<OidOf> {
Expand Down
4 changes: 2 additions & 2 deletions src/hook/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl HookExpr {
let output = [version.to_string(), string].join("");
return Ok(output);
}
_ => return Err(anyhow!("Unexpected token in hook expression : {:?}", token)),
_ => return Err(anyhow!("Unexpected token in hook expression:{:?}", token)),
};
}

Expand All @@ -167,7 +167,7 @@ impl HookExpr {
Token::Major => Ok(HookExpr::increment_major(version, amt)),
Token::Minor => Ok(HookExpr::increment_minor(version, amt)),
Token::Patch => Ok(HookExpr::increment_patch(version, amt)),
_ => Err(anyhow!("Unexpected token in hook expression : {:?}", token)),
_ => Err(anyhow!("Unexpected token in hook expression:{:?}", token)),
},
}
}
Expand Down
Loading

0 comments on commit 3f21a55

Please sign in to comment.