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

git.commitEntry make end of line style configurable #679

Closed
xDivisionByZerox opened this issue Mar 26, 2022 · 0 comments · Fixed by #681
Closed

git.commitEntry make end of line style configurable #679

xDivisionByZerox opened this issue Mar 26, 2022 · 0 comments · Fixed by #681
Assignees
Labels
c: feature Request for new feature p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug

Comments

@xDivisionByZerox
Copy link
Member

xDivisionByZerox commented Mar 26, 2022

Clear and concise description of the problem

Current implementation sets the EOL style to '\r\n'.

Suggested solution

Add an option to configure the EOL character to the users preferred style

commitEntry(options: { 
  merge?: boolean,
  eol?: 'LF' | 'CRLF' 
} = {}): string {
    let eolChar = '\r\n';
    if (options.eol === 'LF') {
        eolChar = '\n';
    }

    let entry = 'commit {{git.commitSha}}' + eolChar;

    if (options.merge || this.faker.datatype.number({ min: 0, max: 4 }) === 0) {
      entry += 'Merge: {{git.shortSha}} {{git.shortSha}}' + eolChar;
    }

    entry +=
      'Author: {{name.firstName}} {{name.lastName}} <{{internet.email}}>' + eolChar;
    entry += 'Date: ' + this.faker.date.recent().toString() + eolChar;
    entry +=  eolChar + 'xa0\xa0\xa0\xa0{{git.commitMessage}}' + eolChar;

    return this.faker.fake(entry);
 }

Alternative

No response

Additional context

Use '\r\n' as default EOL character to not break current implementations.

@xDivisionByZerox xDivisionByZerox added the s: pending triage Pending Triage label Mar 26, 2022
@Shinigami92 Shinigami92 added c: feature Request for new feature p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug and removed s: pending triage Pending Triage labels Mar 26, 2022
@Shinigami92 Shinigami92 added this to the v6.2 - New small features milestone Mar 26, 2022
@Shinigami92 Shinigami92 moved this to Todo in Faker Roadmap Mar 26, 2022
@ejcheng ejcheng moved this from Todo to In Progress in Faker Roadmap Mar 26, 2022
@ST-DDT ST-DDT moved this from In Progress to Awaiting Review in Faker Roadmap Apr 2, 2022
Repository owner moved this from Awaiting Review to Done in Faker Roadmap Apr 23, 2022
@ST-DDT ST-DDT removed this from Faker Roadmap Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature p: 1-normal Nothing urgent s: accepted Accepted feature / Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants