- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.2k
[Merged by Bors] - Comprehensive CONTRIBUTING.md #2040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
            alice-i-cecile
  wants to merge
  61
  commits into
  bevyengine:main
from
alice-i-cecile:better-contributing
  
      
      
   
      
    
  
     Closed
                    Changes from 59 commits
      Commits
    
    
            Show all changes
          
          
            61 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      5dc01d5
              
                First draft of CONTRIBUTING.md
              
              
                alice-i-cecile 01d0337
              
                Added PR workflow from website
              
              
                alice-i-cecile 4f3c71d
              
                Added note on manual CI triggering :(
              
              
                alice-i-cecile 86f8774
              
                Remove outdated flag
              
              
                alice-i-cecile 9f12666
              
                Typo fix
              
              
                alice-i-cecile 9559154
              
                Reminder to add examples to README
              
              
                alice-i-cecile 316520c
              
                Added advice on adding new crate
              
              
                alice-i-cecile cb4ff83
              
                Fixes of assorted tiny errors
              
              
                alice-i-cecile 172616e
              
                Added .gitattributes file to configure line endings
              
              
                alice-i-cecile 651f45c
              
                Removed reference to Cheatbook
              
              
                alice-i-cecile 4e27395
              
                Banish rogue *
              
              
                alice-i-cecile fac74c4
              
                Polish
              
              
                alice-i-cecile 3692613
              
                Improved clarity of devlogs suggestion
              
              
                alice-i-cecile 417c8d9
              
                Add markdownlint advice
              
              
                alice-i-cecile 31344e8
              
                Added links to sections
              
              
                alice-i-cecile a525e23
              
                Improved clarity on Relevant example criteria
              
              
                alice-i-cecile 14309fd
              
                Removed need for sub-crate LICENSE.md
              
              
                alice-i-cecile d6f99eb
              
                Typo fix
              
              
                alice-i-cecile efbdc57
              
                Shout out!
              
              
                alice-i-cecile bededcf
              
                Added link
              
              
                alice-i-cecile bd55ce4
              
                Added link
              
              
                alice-i-cecile 2c50f37
              
                More links!
              
              
                alice-i-cecile 227d6cb
              
                Typo fix
              
              
                alice-i-cecile 9f4c71a
              
                Maybe fixed line-break behavior
              
              
                alice-i-cecile 2c3a9bb
              
                Examples also need  to be referenced in Cargo.toml
              
              
                alice-i-cecile a2d476c
              
                Mac-friendly searching instructions
              
              
                alice-i-cecile 80d28d1
              
                More advice on review process
              
              
                alice-i-cecile e1adb2a
              
                Typo fix
              
              
                alice-i-cecile ba78322
              
                Advice on splitting commits
              
              
                alice-i-cecile cf32dfd
              
                Magically fixed line break in rendered version
              
              
                alice-i-cecile b243e68
              
                Added summary of doc
              
              
                alice-i-cecile 49d4fa7
              
                Testing...
              
              
                alice-i-cecile a38f1d6
              
                Fixed line break, for real this time
              
              
                alice-i-cecile 6a86ca3
              
                Wording clarity edits
              
              
                alice-i-cecile db99662
              
                Explain bors
              
              
                alice-i-cecile 3ca0a23
              
                Add link
              
              
                alice-i-cecile ab6a9a4
              
                Mention bumping PRs that need review on Discord
              
              
                alice-i-cecile c144577
              
                Bevy contributors are really more bird-like
              
              
                alice-i-cecile 7f6d9c2
              
                Cleanup .gitattributes file
              
              
                alice-i-cecile eb7d65c
              
                Guidance on how to approve PRs
              
              
                alice-i-cecile e5db464
              
                Remove old CONTRIBUTING.md file
              
              
                alice-i-cecile 0675a75
              
                Added stub style guides
              
              
                alice-i-cecile b3667b0
              
                Draft example style guide
              
              
                alice-i-cecile 43982e4
              
                Draft engine style guide
              
              
                alice-i-cecile 4311862
              
                Distributed PR triggering powers!
              
              
                alice-i-cecile 9f79e80
              
                Clearer local CI advice
              
              
                alice-i-cecile 967299c
              
                Fixed broken links
              
              
                alice-i-cecile a57e667
              
                Cargo features note
              
              
                alice-i-cecile 7c6adaa
              
                Fixed link, maybe?
              
              
                alice-i-cecile c5b24ab
              
                Remove complaining link
              
              
                alice-i-cecile d816c3c
              
                Consistency
              
              
                alice-i-cecile 3586038
              
                Removed newline
              
              
                alice-i-cecile afadffb
              
                fix broken doc links
              
              
                NathanSWard d709ed8
              
                Merge branch 'better-contributing' into better-contributing-link-fix
              
              
                NathanSWard 7bfa933
              
                Merge pull request #1 from NathanSWard/better-contributing-link-fix
              
              
                alice-i-cecile 520966a
              
                re-add examples style guide link
              
              
                NathanSWard b2ca0d8
              
                Merge pull request #2 from NathanSWard/better-contributing-link-fix
              
              
                alice-i-cecile 27c2514
              
                Expand, update, and tweak
              
              
                cart 8a8c204
              
                Merge branch 'main' into better-contributing
              
              
                cart 35846d7
              
                resolve validation issues
              
              
                cart 41d9555
              
                address comments
              
              
                cart File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # From: https://docs.github.com/en/github/getting-started-with-github/configuring-git-to-handle-line-endings | ||
| # Set the default behavior, in case people don't have core.autocrlf set. | ||
| * text=auto | ||
|         
                  alice-i-cecile marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| # Explicitly declare text files you want to always be normalized and converted | ||
| # to native line endings on checkout. | ||
| *.rs text eof=lf | ||
| *.toml text eof=lf | ||
| *.frag text | ||
| *.vert text | ||
|  | ||
| # Declare files that will always have CRLF line endings on checkout. | ||
| *.sln text eol=crlf | ||
|  | ||
| # Denote all files that are truly binary and should not be modified. | ||
| *.png binary | ||
| *.jpg binary | ||
| *.ttf binary | ||
This file was deleted.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Style guide: Engine | ||
|  | ||
| For more advice on contributing to the engine, see the [relevant section](../../CONTRIBUTING.md#Contributing-your-own-ideas) of CONTRIBUTING.md. | ||
|  | ||
| 1. Prefer granular imports over glob imports of `bevy::prelude::*` and `bevy::sub_crate::*`. | ||
| 2. Use a consistent comment style: | ||
| 1. `///` doc comments belong above `#[derive(Trait)]` invocations. | ||
| 2. `//` comments should generally go above the line in question, rather than in-line. | ||
| 3. Avoid `/* */` block comments, even when writing long comments. | ||
| 4. Use \`variable_name\` code blocks in comments to signify that you're referring to specific types and variables. | ||
| 5. Start comments with capital letters. End them with a period if they are sentence-like. | ||
| 3. Use comments to organize long and complex stretches of code that can't sensibly be refactored into separate functions. | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Style guide: Examples | ||
|  | ||
| For more advice on writing examples, see the [relevant section](../../CONTRIBUTING.md#writing-examples) of CONTRIBUTING.md. | ||
|  | ||
| ## Organization | ||
|  | ||
| 1. Examples should live in an appropriate subfolder of `/examples`. | ||
| 2. Examples should be a single file if possible. | ||
| 3. Assets live in `./assets`. Try to avoid adding new assets unless strictly necessary to keep the repo small. Don't add "large" asset files. | ||
| 4. Each example should try to follow this order: | ||
| 1. Imports | ||
| 2. A `fn main()` block | ||
| 3. Example logic | ||
| 4. \[Optional\] Tests | ||
| 5. Try to structure app / plugin construction in the same fashion as the actual code. | ||
|  | ||
| ## Stylistic preferences | ||
|  | ||
| 1. Use simple, descriptive variable names. | ||
| 1. Avoid names like `MyComponent` in favor of more descriptive terms like `Events`. | ||
| 2. Prefer single letter differentiators like `EventsA` and `EventsB` to nonsense words like `EventsFoo` and `EventsBar`. | ||
| 3. Avoid repeating the type of variables in their name where possible. For example, `Color` should be preferred to `ColorComponent`. | ||
| 2. Prefer glob imports of `bevy::prelude::*` and `bevy::sub_crate::*` over granular imports (for terseness). | ||
| 3. Use a consistent comment style: | ||
| 1. `///` doc comments belong above `#[derive(Trait)]` invocations. | ||
| 2. `//` comments should generally go above the line in question, rather than in-line. | ||
| 3. Avoid `/* */` block comments, even when writing long comments. | ||
| 4. Use \`variable_name\` code blocks in comments to signify that you're referring to specific types and variables. | ||
| 5. Start comments with capital letters; end them with a period if they are sentence-like. | ||
| 4. Use comments to organize long and complex stretches of code that can't sensibly be refactored into separate functions. | ||
| 5. Avoid making variables `pub` unless it is needed for your example. | ||
|  | ||
| ## Code conventions | ||
|  | ||
| 1. Refactor configurable values ("magic numbers") out into constants with clear names. | ||
| 2. Prefer `for` loops over `.for_each`. The latter is faster (for now), but it is less clear for beginners, less idiomatic, and less flexible. | ||
| 3. Use `.single` and `.single_mut` where appropriate. | ||
| 4. In Queries, prefer `With<T>` filters over actually fetching unused data with `&T`. | ||
| 5. Prefer disjoint queries using `With` and `Without` over query sets when you need more than one query in a single system. | ||
| 6. Prefer structs with named fields over tuple structs except in the case of single-field wrapper types. | ||
| 7. Use enum-labels over string-labels for system / stage / etc. labels. | ||
|  | ||
| ## "Feature" examples | ||
|  | ||
| These examples demonstrate the usage of specific engine features in clear, minimal ways. | ||
|  | ||
| 1. Focus on demonstrating exactly one feature in an example | ||
| 2. Try to keep your names divorced from the context of a specific game, and focused on the feature you are demonstrating. | ||
| 3. Where they exist, show good alternative approaches to accomplish the same task and explain why you may prefer one over the other. | ||
| 4. Examples should have a visible effect when run, either in the command line or a graphical window. | ||
|  | ||
| ## "Game" examples | ||
|  | ||
| These examples show how to build simple games in Bevy in a cohesive way. | ||
|  | ||
| 1. Each of these examples lives in the [/examples/games] folder. | ||
| 2. Aim for minimum but viable status: the game should be playable and not obviously buggy but does not need to be polished, featureful, or terribly fun. | ||
| 3. Focus on code quality and demonstrating good, extensible patterns for users. | ||
| 1. Make good use of enums and states to organize your game logic. | ||
| 2. Keep components as small as possible but no smaller: all of the data on a component should generally be accessed at once. | ||
| 3. Keep systems small: they should have a clear single purpose. | ||
| 4. Avoid duplicating logic across similar entities whenever possible by sharing systems and components. | ||
| 4. Use `///` doc comments to explain what each function / struct does as if the example were part of a polished production codebase. | ||
| 5. Arrange your code into modules within the same file to allow for simple code folding / organization. | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.