thealgorithms / scripts Goto Github PK
View Code? Open in Web Editor NEWScripts used across all The Algorithms repositories
License: MIT License
Scripts used across all The Algorithms repositories
License: MIT License
This is an issue to track the adding annotations to the filename script.
What do we mean by annotations? The following is an example of an annotation generated by a linter called golangci-lint. Generating them is quite straight forward, the docs explain this quite nicely.
If this script is to be used by multiple language repos then it should be moved to https://github.com/TheAlgorithms/.github
Most of the main branches are protected, which means the scripts won't be able to push unless they unprotect the branches, which would be 100% not safe, IMO.
To prevent this, we could create a temporary branch and create a PR to perform the changes without removing branch protection.
For us to be able to finish the filename actions batch, we need to provide our script the capability of returning a list of filenames so that we can use those filenames to send PR annotations to a user.
The main parts of this script already exist, this issue is to track the idea of finding all the filenames that are incorrect and returning (outputting) to the caller.
TheAlgorithms/C#1242 (comment) for more information about the idea of the script.
Created an issue here as I was planning to also add it in the C++ repository, and potentially other repositories as well.
Currently, we have a readme where it explains the use of the directory builder.
However, that guide is outdated, and we do not have guides for the other script(s).
I suggest we add a README.md
inside their respective folders explaining what it does, how it works, etc..
Let me know your thoughts about this. Thank you. ๐
We tried to introduce TheAlgorithms/scripts/directory_md
into TheAlgorithms/Ruby with TheAlgorithms/Ruby#209, but after the merge it failed to run with the following error:
python: can't open file '/home/runner/work/Ruby/Ruby/build_directory_md.py': [Errno 2] No such file or directory
# Build Directory step
Run TheAlgorithms/scripts/directory_md@main
with:
language: Ruby
working-directory: .
filetypes: .rb
branch-name: directory-update
Run echo "/home/runner/work/_actions/TheAlgorithms/scripts/main/directory_md" >> $GITHUB_PATH
echo "/home/runner/work/_actions/TheAlgorithms/scripts/main/directory_md" >> $GITHUB_PATH
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
Run actions/setup-python@v4
with:
python-version: 3.x
check-latest: false
token: ***
update-environment: true
allow-prereleases: false
Installed versions
Successfully set up CPython (3.11.4)
Run git config --global user.name github-actions[bot]
git config --global user.name github-actions[bot]
git config --global user.email '[email protected]'
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.4/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib
Run # If branch exists, change to that branch to prevent multiple committing/PR creation.
# If branch exists, change to that branch to prevent multiple committing/PR creation.
git checkout directory-update || true
python build_directory_md.py Ruby . .rb > DIRECTORY.md
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.11.4/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.4/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.4/x64/lib
error: pathspec 'directory-update' did not match any file(s) known to git
python: can't open file '/home/runner/work/Ruby/Ruby/build_directory_md.py': [Errno 2] No such file or directory
Error: Process completed with exit code 2.
After discussing this with @Panquesito7 in the PR, it seems that the GitHub Action needs to be modified, so I am reporting it here. Thanks!
There's a filename formatter that's being used already in various repositories, such as
the TypeScript repository repository, the C/C++ repositories, and soon other repositories as well.
This is not a Python script but more of a Bash script, I guess.
What do you think? Should we adjust it and add it to this repository? Thanks.
IFS=$'\n'
for fname in `find . -type f -name '*.cpp' -o -name '*.hpp'`
do
echo "${fname}"
new_fname=`echo ${fname} | tr ' ' '_'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr 'A-Z' 'a-z'`
echo " ${new_fname}"
new_fname=`echo ${new_fname} | tr '-' '_'`
echo " ${new_fname}"
if [ ${fname} != ${new_fname} ]
then
echo " ${fname} --> ${new_fname}"
git "mv" "${fname}" ${new_fname}
fi
done
CC: @raklaptudirm, @appgurueu, you might want to check this out as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.