Giter VIP home page Giter VIP logo

Comments (7)

mdeweerd avatar mdeweerd commented on August 30, 2024 1

IMHO, if the user specifies an empty comment-style, then not adding the space seems the right thing to do (even if that changes the behavior for users that have set an empty comment-style).
That alone is a solution for me.

Maybe I'll add the new option to disable adding the space, but then this implies more work (tests), so I am not sure I am going to do that.

from pre-commit-hooks.

mdeweerd avatar mdeweerd commented on August 30, 2024 1

Changed --no-space proposal to --no-space-in-comment-prefix as requested in #31 and created PR #33 .

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on August 30, 2024

Because we always introduce a whitespace character between the comment prefix and the license lines, this is indeed not currently possible: https://github.com/Lucas-C/pre-commit-hooks/blob/master/pre_commit_hooks/insert_license.py#L76

The best you can achieve is this I think:

# #############################################################################
# Copyright (C) 2017 Teela O'Malley
#
# Licensed under the Apache License, Version 2.0 (the "License");
# #############################################################################

import sys
sys.stdout.write("FOO")

With this license file:

#############################################################################
Copyright (C) 2017 Teela O'Malley

Licensed under the Apache License, Version 2.0 (the "License");
#############################################################################

and --comment-style="#"

from pre-commit-hooks.

mdeweerd avatar mdeweerd commented on August 30, 2024

@Lucas-C Thanks for responding.

This issue is all about the added space.

I find --comment-style '' somewhat better, because it adds a space at the start, I'ld suggest that an empty comment-style would not add anything to the licence file contents.

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on August 30, 2024

Pull Requests are welcome 😊

from pre-commit-hooks.

mdeweerd avatar mdeweerd commented on August 30, 2024

Good, they not always are ...

So you're good with an empty comment-style resulting in no spaces added?

Maybe I'll throw in an option to disable the addition of the space as well - is --no-space ok for you as an option?

from pre-commit-hooks.

Lucas-C avatar Lucas-C commented on August 30, 2024

So you're good with an empty comment-style resulting in no spaces added?

Yes, sounds good.
We just need to check how the tests behave after implementing this: I won't accept a PR that changes this hook behaviour for existing users.

Maybe I'll throw in an option to disable the addition of the space as well - is --no-space ok for you as an option?

Could you clarify if your plan is to change this hook default behaviour, or if you plan to add an extra option for more control over it?

from pre-commit-hooks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.