GithubHelp home page GithubHelp logo

Comments (7)

dlesnoff avatar dlesnoff commented on May 19, 2024

There are currently two problems with the script directory.nim:
– new repositories from other branches are untracked by default on local directories. That means scripts within directories created in another branch appear in the generated DIRECTORY.md file.
– There is no enforced capitalization. We could enforce lowercase except for the first letter and except for proper names like Viterbi, Karatsuba, Luhn, etc …
The script is okay as it is, as I do not want to maintain an algorithm to decide whether a name is proper and the GitHub Action would determine the DIRECTORY.md file in the remote repository solving the first issue.

I am not sure to understand why you prefer to create another branch rather than modifying the pull request's branch. Would it be that much terrible to modify the pull request directly?
Creating another branch would artificially double the number of commits in the commit history. It adds manual work.

from nim.

ZoomRmc avatar ZoomRmc commented on May 19, 2024

– There is no enforced capitalization. We could enforce lowercase except for the first letter and except for proper names like Viterbi, Karatsuba, Luhn, etc …

The titles inferred from the file names are Title Cased unless the unit has a canonical title in the first line (iff it's a doc comment) of the file. Maintaining the dictionary of canonical title spellings is unfeasible, so I intended to lay this responsibility on unit authors.

– new repositories from other branches are untracked by default on local directories. That means scripts within directories created in another branch appear in the generated DIRECTORY.md file.

Not sure WDYM here. Do you mean the situation of working on different branches at the same time and the fact that the script takes the state of the working tree for granted and is ignorant of the git state?

from nim.

dlesnoff avatar dlesnoff commented on May 19, 2024

Sorry, these issues have nothing to do with the script itself.
I agree with you that management of correct title spelling is unfeasible, we can leave it as it is.
We may have to untrack files by default and explicitly add the files tracked in .gitignore. Otherwise the script adds any untracked file from other branches, since those are not git ignored. Files from other branches stay in the repository across branches if there are inside an untracked directory.

I will give an example. Let us say we are in the main git branch.
We want to add algorithm X, so we create a new branch and checkout into it:

git checkout -b algorithmX

Now, algorithm X is a mathematical algorithm, so we put it into a new maths directory.

mkdir maths
touch maths/algorithmX.nim
git commit -am "Add algorithm X"

If we checkout again in the main branch, here is what git status returns:

git checkout main
git status -s
?? maths/

If we run directory.nim

nim r .scripts/directory.nim > DIRECTORY.md
git commit -am "chore: Update DIRECTORY.md file"

Then the DIRECTORY.md contains the algorithmX entry.

from nim.

dlesnoff avatar dlesnoff commented on May 19, 2024

Actually, since we can not have per-branch .gitignore files, my proposed solution to exclude all files by default and add each one of them would not work.

from nim.

ZoomRmc avatar ZoomRmc commented on May 19, 2024

Ok, so I understood you correctly.

Depending on the planned use-case:

  1. Run the script automatically after merging PRs: this problem doesn't occur.
  2. Require authors to use the script as the part of their PRs:
    a. Require authors to stash-clean the working tree before updating:
    git stash --include-untracked
    nim r .scripts/directory.nim > directory.md
    git add directory.md # unnecessary if the repo already tracks the file
    git commit directory.md -m "Update directory,md"
    git stash apply
    
    b. Automate the above from the script iteself

from nim.

dlesnoff avatar dlesnoff commented on May 19, 2024

2.a. is a terribly complex solution for beginners. It would discourage people from contributing.
So 1. or 2.b.
Notice that option 1, in addition to doubling the commits, it may require a second maintainer to merge a single P.R. when there is any problem with the directory.md file.
2.b in a Git Hook/Github Action seems fine to me.

from nim.

Panquesito7 avatar Panquesito7 commented on May 19, 2024

I am not sure to understand why you prefer to create another branch rather than modifying the pull request's branch. Would it be that much terrible to modify the pull request directly?

It could mess up people's work if they're about to push a change and similar stuff like that.
Also, running the workflow on every push will also ensure there are no DIRECTORY.md merge conflicts on other PRs.

from nim.

Related Issues (13)

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.