Where Can I Get a Code Review for My Scripts?

0
6
Asked By CasualCoder92 On

I'm a beginner looking to improve my coding skills and I've written a couple of scripts (around 50 lines each, not counting comments). While they work, I want to ensure I'm not making any major mistakes or writing inefficient code. Is there a community or platform where I can share my scripts for critiquing? Here are the links to the scripts: [Script 1](https://gitlab.com/rayken.wong/random_scripts/-/blob/main/QR-code-bookmarking/qrtobookmarks-pdftk?ref_type=heads) and [Script 2](https://gitlab.com/rayken.wong/random_scripts/-/blob/main/QR-code-bookmarking/qrtobookmarks(pdftk).ps1?ref_type=heads).

3 Answers

Answered By SyntaxNinja42 On

Hey! While I'm not a bash expert, I can provide some feedback on your scripts. Here are a few tips:

1. Use meaningful variable names instead of generic ones like var0 and folder1.

2. Consider reducing the number of comments – rely more on clean code.

3. Break your code into functions. It improves readability and reduces the need for excessive comments.

4. Use "#!/usr/bin/env bash" for better portability.

5. Rearranging your code to define variables before commands might be more logical.

6. Implement error handling to manage failures gracefully.

7. Avoid naming conflicts in nested scopes to prevent confusion.

8. Try to reduce nesting by using function calls.

Hope that helps!

HelpfulCoder88 -

Great advice! Splitting the code into functions is a game-changer for debugging. Future you will definitely appreciate clearer variable names!

ScriptSeeker -

Thanks for the insights! I’ll take a closer look at these suggestions!

Answered By OpenSourceFanatic On

If you post your scripts on GitHub, I'd be happy to take a look and provide feedback! Let me know when you do.

CasualCoder92 -

I've updated the links in my post! Thank you for your willingness to help!

Answered By LinuxGuru01 On

Just a quick note: in Linux, you can use the 'file' command to identify file types accurately, which can help you out beyond just looking at extensions. Here's a quick guide on it: https://www.hostinger.com/tutorials/linux-file-command. Good luck!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.