Skip to content

Latest commit

 

History

History
323 lines (263 loc) · 18.6 KB

CONTRIBUTING.md

File metadata and controls

323 lines (263 loc) · 18.6 KB

Contributing to DiscImageChef

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

The following is a set of guidelines for contributing to DiscImageChef and its modules. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

Table Of Contents

Code of Conduct

I don't want to read this whole thing, I just have a question!!!

What should I know before I get started?

How Can I Contribute?

Styleguides

Code of Conduct

This project and everyone participating in it is governed by the DiscImageChef Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to claunia@claunia.com.

I don't want to read this whole thing I just have a question!!!

Note: Please don't file an issue to ask a question. You'll get faster results by using the resources below.

You can join our IRC channel on chat.freenode.net at channel #DiscImageChef

What should I know before I get started?

DiscImageChef and modules

DiscImageChef is a large open source project — it's made up of 18 modules. When you initially consider contributing to DiscImageChef, you might be unsure about which of those modules implements the functionality you want to change or report a bug for. This section should help you with that.

DiscImageChef is intentionally very modular. Here's a list of them:

  • Claunia.RsrcFork - This library includes code for handling Mac OS resource forks, and decoding them, so any code related to Mac OS resource forks should be added here.
  • Claunia.Encoding - This library includes code for converting codepages not supported by .NET, like those used by ancient operating systems, to/from UTF-8.
  • plist-cil - This library includes code for handling Apple property lists.
  • SharpCompress - This library includes code for handling compression algorithms and compressed archives. Any need you have of compression or decompression should be handled with this library, and any new algorithm should be added here.
  • DiscImageChef - This module contains the command line interface. In the future a GUI will be added.
  • DiscImageChef.Checksums - This module contains the checksum, hashing and error correction algorithms.
  • DiscImageChef.CommonTypes - This module contains interfaces, structures and enumerations needed by more than one of the other modules.
  • DiscImageChef.Console - This module abstracts consoles used by other modules to output information, so they can be redirected to a CLI or to a GUI output.
  • DiscImageChef.Core - This module contains the implementation of the functions and commands that are called by the user interface itself.
  • DiscImageChef.Decoders - This module contains internal disk, drive and protocol structures as well as code to marshal, decode and print them.
  • DiscImageChef.Devices - This module contains code to talk with hardware devices in different platforms. Each platform has lowlevel calls in its own folder, and each device protocol has highlevel calls in its own folder. Device commands are separated by protocol standard, or vendor name.
  • DiscImageChef.Device.Report - This is a separate application in C89 designed to create device reports on enviroments where you can't run .NET or Mono but can run Linux.
  • DiscImageChef.DiscImages - This module provides reading capabilities for the disk/disc images, one per file.
  • DiscImageChef.Filesystems - This module provides the filesystem support. If only identification is implemented a single file should be used. For full read-only support, a folder should be used.
  • DiscImageChef.Filters - A filter is a modification of the data before it can be passed to the disk image module (compression, fork union, etc), and this module provides support for them. If a image is compressed, say in gzip, or encoded, say in AppleDouble, a filter is the responsible of decompressing or decoding it on-the-fly.
  • DiscImageChef.Helpers - This module contains a collection of helpers for array manipulation, big-endian marshalling, datetime conversion, hexadecimal printing, string manipulation and byte swapping.
  • DiscImageChef.Partitions - This module contains code for reading partition schemes.
  • DiscImageChef.Server - This module contains the server-side code that's running at https://www.discimagechef.app
  • DiscImageChef.Settings - This module contains code for handling DiscImageChef settings.
  • DiscImageChef.Tests - This module contains the unit tests for the rest of the modules. You should add new unit tests here but cannot run all of them because the test images they require amount to more than 100GiB.
  • DiscImageChef.Tests.Devices - This module presents a menu driven interface to send commands to devices, as a way to test the Core module, as those tests cannot be automated. It can be used to debug drive responses.

How Can I Contribute?

Reporting Devices

DiscImageChef tries to be as universal as possible. However some devices do not behave in the expected ways, some media is unknown and needs to be known prior to enabling dumping of it, etc.

For that reason, DiscImageChef includes the device-report command. Using this command will guide you thru a series of questions about the device, and if it contains removable media, for you to insert the different media you have, and create a report of its abilities. The report will automatically be sent to our server and saved on your computer. Please note that we do not store any personal information and when possible remove the drive serial numbers from the report.

If you have a drive attached to a computer that you cannot run the full DiscImageChef on it but can compile a C89 application, you can use DiscImageChef.Device.Report. In this case the report will only be created locally and you should attach it to a bug report.

Reporting Bugs

This section guides you through submitting a bug report for DiscImageChef. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 💻 💻, and find related reports 🔎.

Before creating bug reports, please check this list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible. Fill out the required template, the information it asks for helps us resolve issues faster.

Note: If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.

Before Submitting A Bug Report

How Do I Submit A (Good) Bug Report?

Bugs are tracked as GitHub issues. After you've determined which module your bug is related to, create an issue on that repository and provide the following information by filling in the template.

Explain the problem and include additional details to help maintainers reproduce the problem:

  • Use a clear and descriptive title for the issue to identify the problem.
  • Describe the exact steps which reproduce the problem in as many details as possible. For example, start by explaining how you started DiscImageChef, e.g. which command exactly you used in the terminal. Also note that some device commands requires you to have administrative privileges, be in a specific group, or be the root user, so try it again with escalated privileges.
  • Provide specific examples to demonstrate the steps. Include links to media images, reports of the devices, or the output of using DiscImageChef.Tests.Devices.
  • Describe the behavior you observed after following the steps and point out what exactly is the problem with that behavior.
  • Explain which behavior you expected to see instead and why.
  • Include a copy of the output in the terminal enabling both verbose, using the -v command line parameter, and debug, using the -d command line parameter, outputs.
  • If you're reporting that DiscImageChef crashed, try doing the same with the debug version and include a crash report with a stack trace. Include the crash report in the issue in a code block, a file attachment, or put it in a gist and provide link to that gist.
  • If the problem wasn't triggered by a specific action, describe what you were doing before the problem happened and share more information using the guidelines below.

Include details about your configuration and environment:

  • Which version of DiscImageChef are you using?
  • What's the name and version of the OS you're using?
  • Are you running DiscImageChef in a virtual machine? If so, which VM software are you using and which operating systems and versions are used for the host and the guest?
  • Are you trying to execute a device command? If so, who manufactured the device, which model is it, and how is it connected to the computer?

Suggesting Enhancements

This section guides you through submitting an enhancement suggestion for DiscImageChef, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion 📝 and find related suggestions 🔎.

Before creating enhancement suggestions, please include as many details as possible. Fill in the template, including the steps that you imagine you would take if the feature you're requesting existed.

How Do I Submit A (Good) Enhancement Suggestion?

Enhancement suggestions are tracked as GitHub issues. After you've determined which module your enhancement suggestion is related to, create an issue on that repository and provide the following information:

  • Use a clear and descriptive title for the issue to identify the suggestion.
  • Provide a step-by-step description of the suggested enhancement in as many details as possible.
  • Provide specific examples to demonstrate the steps. If the feature is about a media image, filesystem, partitioning scheme, or filter, please include as many test files as possible, and if applicable which software created them.
  • Describe the current behavior and explain which behavior you expected to see instead and why.
  • List some other applications where this enhancement exists.
  • Specify which version of DiscImageChef you're using.
  • Specify the name and version of the OS you're using.

Your First Code Contribution

Unsure where to begin contributing to DiscImageChef? You can start by looking through these beginner and help-wanted issues:

  • [Beginner issues][beginner] - issues which should only require a few lines of code, and a test or two.
  • [Help wanted issues][help-wanted] - issues which should be a bit more involved than beginner issues.

Both issue lists are sorted by total number of comments. While not perfect, number of comments is a reasonable proxy for impact a given change will have.

If you want to read about using DiscImageChef, the wiki is available.

Do not modify the interfaces. If you need or want to, comment in an issue how and why you want to change it and we'll discuss it. Same applies for creating new interfaces.

DiscImageChef uses C# 7 language features (inline declaration, Tuples, etc.) so it can only be compiled with VisualStudio 2017 or higher, Xamarin Studio 7 or higher, MonoDevelop 7 or higher, or JetBrains Rider 2017.2 or higher.

Pull Requests

  • Fill in the required template
  • Do not include issue numbers in the PR title
  • Follow the code styleguide.
  • Include test files as applicable, that do not have software under copyright inside them, if possible.
  • Document new code based using XML documentation wherever possible.
  • DO NOT end files with a newline.
  • Avoid platform-dependent code, unless absolutely needed. Any call to a part of the .NET framework that doesn't start with System. is probably platform-dependent.
  • Do not call libraries external to .NET. Only Interop calls to the operating system kernel (that is KERNEL32.DLL in Windows and libc in others) will be accepted. If you need to talk with a USB devices your pull request must implement calls both to WinUsb and libusb.

Patronizing

If you want to donate money you can become a patron at https://www.patreon.com/DiscImageChef

This money will be used to get more hardware on which to test DiscImageChef.

Donating

You may donate us one of the devices we need.

Needed information

If you have test images, imaging applications that generate formats we do not support, or documentation about media dump formats, filesystems or partitioning schemes we do not support, you can provide us with that information to add support for them.

Styleguides

Git Commit Messages

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
  • Limit the first line to 72 characters or less
  • Reference issues and pull requests liberally after the first line
  • Consider starting the commit message with an applicable emoji:
    • 🎨 :art: when improving the format/structure of the code
    • 🐎 :racehorse: when improving performance
    • 🚱 :non-potable_water: when plugging memory leaks
    • 📝 :memo: when writing docs
    • 🐧 :penguin: when fixing something on Linux
    • 🍎 :apple: when fixing something on macOS
    • 🏁 :checkered_flag: when fixing something on Windows
    • 🐛 :bug: when fixing a bug
    • 🔥 :fire: when removing code or files
    • 💚 :green_heart: when fixing the CI build
    • :white_check_mark: when adding tests
    • 🔒 :lock: when dealing with security
    • ⬆️ :arrow_up: when upgrading dependencies
    • ⬇️ :arrow_down: when downgrading dependencies
    • 👕 :shirt: when removing linter warnings

Code Styleguide

  • Braces are unindented at next line (BSD style).
  • Braces with no content should be opened and closed in the same line.
  • Constants should be ALL_UPPER_CASE.
  • Do not use braces for statements that don't need them.
  • Do not use more than one blank line.
  • Do not use spaces before or after parentheses.
  • Do not use var ever.
  • else, while, catch and finally should be on a new line.
  • If you know C apply a simple rule: Be as C as and as less C# or C++ as possible.
  • If you will only store variables, use a struct. If you need it to be nullable, use a nullable struct if applicable.
  • Indent statements and cases.
  • Indent using 4 spaces (soft tab).
  • Instace and static fields should be lowerCamelCase.
  • Public fields should be UpperCamelCase.
  • Separate attributes.
  • Use 120 columns margins.
  • Use built-in keywords: uint instead of UInt32.
  • Use expression bodies only for properties, indexes and events. For the rest use block bodies.
  • Use implicit modifiers.
  • Use inline variable declaration.
  • Use struct implicit constructor.
  • Use UNIX (\n) endline character.

Note: DiscImageChef is quite low-level so unneeded object-oriented abstractions (e.g. using classes when a struct suffices) will be rejected. LINQ is accepted.