Coder Social home page Coder Social logo

sqf_comment_remover's Introduction

SQF_Comment_Remover

A few simple executables to remove comments, empty lines, and newlines from SQF code in 1 click.

Purpose

The purpose of this project is to provide a simple way to remove comments, empty lines, and newlines from Arma 2 mission folders. This not only saves a lot of file size on your mission folder, but it also makes it harder for others to steal/understand your code.

Usage

  • In either usage you choose: before using the executable(s), I would make a backup of your mission folder before you start in case of any unforeseen bugs. While I don't believe any bugs still exist (I have tested this fairly thoroughly), it's always better to be safe than sorry.
  • My recommended usage:
    • You should always have a local test server on your machine for testing and developing and then a dedicated one for your actual server (do not host the dedicated server on your own network...)
    • Write a ton of comments in your sqf files to help you document your own work. This is a good habit to get into. There is no penalty for adding a ton of comments now as you will remove them in the coming steps.
    • Now there are a few ways you can do this, but when you are ready to upload your current test server files to your dedicated machine, make a copy of your mission folder and run the executable in the root of the copy, run it/them and then take them out of the mission folder. Then upload the copy to your dedicated server.
      • To be clear, mission folder looks like DayZ_Epoch_11.Chernarus
  • Bare minimum usage:
    • Stick the executable and settings inside your mission folder. Now Run it. Now remove the executable and settings from the mission folder. Now upload the mission folder to your dedicated server.
  • What the settings do:
    • remove_comments: Removes comments from .sqf, .hpp, and .ext files.
    • remove_empty_lines: Removes empty lines from .sqf, .hpp, and .ext files.
    • remove_excess_spaces: Removes excess spaces from .sqf, .hpp, and .ext files.
    • remove_sqf_newlines: Removes all newlines from .sqf files except #include and #define lines.
    • remove_hppOrExt_newlines: Removes all newlines from .hpp and .ext files except #include and #define lines.
    • excessive_debug_mode: Logs the before and after for each file for each step. This is only useful for testing and debugging. Not recommended to use unless there are issues you are reporting back to me.
    • optional_specified_folder_path: If you want to specify a folder path to remove comments from, you can do so by setting the optional_specified_folder_path to the path you want to remove comments and clean from. Otherwise it will use the current working directory of the executable and do any subfolders within it.
      • An example of a folder path: C:\MyServer\Server\MPMissions\DayZ_Epoch_11.Chernarus
  • Warning: If you accidentally run this in somewhere like the root of your C drive, it will likely run for a long time searching for sqf, hpp, and ext files in the entire drive and modify them respective to the exe you're using. So DO NOT DO THAT. While I should have designed it to require to be within a MPMission folder, I'm not responsible for any damage you might cause.

Let me know if you run into any issues or have any suggestions for the future. I hope you enjoy this tool.

Update History:

  • v1.4.2 - 2022/8/1
    • Remove even more extra spaces with remove_excess_spaces
    • Fixes many bugs regarding lines with # such as #include and #define
  • v1.4.1 - 2022/7/22
    • Added a duplicate remove extra lines function to fix a situation where if the file started with #include or #define, it would have an extra newline above it.
    • Fixed an issue with encoding not being set to utf-8, causing possible encoding errors. Example: The first line in a file starting with #include or #define was adding a BOM to the file.
  • v1.4 - 2022/7/19
    • Added optional_specified_folder_path
    • Fixed errors with #ifndef, #endif, #if, #else and #ifdef
  • v1.3 - 2022/7/18:
    • Adds option to ignore certain files/paths from the cleaner using ignore_these_files.txt
    • Adds optional extra logging when running myApp.py rather than one of the executables.
    • Switched from multiple executables to one executable using setttings.json
    • Should parse a little bit better, getting rid of even more unnecessary whitespace and such.
  • v1.2 - 2022/7/1: Updated all exes to fix issue with files being wiped with newline remover and empty line remover. Also added Excess whitespace remover and included it into clean_it_all. Turns several spaces or tabs into 1 space.
  • v1.1 - 2022/6/28: New comment parsing method. Fixes issues with strings such as https:// and similar which ARE NOT comments.
  • v1.0 - 2022/6/28: Initial release.

Legal

  • You are welcome to use this code in any way you want.
  • I am not responsible for any damage you might cause.
  • I got the original comment_remover code from here and I do not claim credit for writing that part. Regex is powerful and I don't want to reinvent the wheel. This comment_remover code is no longer in use. I am now using this method

sqf_comment_remover's People

Contributors

zzbombardierzz avatar

Watchers

 avatar

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.