This repository is a standardized dotfiles repo for new software engineers or contractors who will be mainly working on the front-end. It's purpose is to offer a close to "1 click" solution which completely provision a new machine in under two hours. There is a base profile and then more specific profiles depending on the tech stack that you will be working in. By the end of running our base profile and the tech stack of your choice, the new engineer should have almost everything required to optimally work on any UI application within an ecosystem of products and services.
- Team Onboarding Dotfiles and Tooling
- Table of Contents
- What IS included?
- What IS NOT included?
- Detailed List of Toolsets
- Ruby on Rails
- Linting and Code Analysis
- TODOS
- WORKFLOW INFORMATION
- DOTFILES TECHNOLOGY INDEX
This dotfiles repo uses dotbot, a popular framework for organizing dotfiles. Within the meta folder you will see two important directories:
- configurations/ - Each of these yml files executes a specific aspect of setting up a new or virtualized machine
- profiles/ - Each profile is a simply file that includes certain configurations, offering flexibility out of the box to create your own unique profile of dotfiles. Common use cases for this would be a personal and professional machine.
Creation of foundational directories that will be used in later operation.
- Github template directories
- Organized folders for different types of repositories
Sensible defaults and settings like:
- Showing hidden files in finder
- Autohiding the dock
- Showing the path in finder
Using the dotbot plugin dotbot-brew, a homebrew bundle file called Brewfile.base lists a collection of libraries and casks (applications) that will be used for most technical stacks on a new machine. This is obviously something that should be highly personalized and is tailored for my React / Ruby on Rails environments.
- Oh-My-ZSH
- All private professional applications checked out in version control
- All private professional applications running locally
- An easy button for your machine's environment. If this repo is cloned, it is highly advised to review and tailor the contents to . The point of this utility is to get an engineer "80% there." The other 20% at their descretion. It is highly recommended to challenge and propose better approaches for any of these given toolsets. If there is a better toolsets, configurations, libraries, etc. let's talk about it as a group, weigh the pros and cons, and possibly try i## Installation Instructions
Accept invitation from github to join our organization, using your personal account is fine.
Setup Git and save in 1password
https://github.com/settings/keys
Download and install Homebrew (alternative article explaining it)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install βgitβ using the command line:
brew install git
Checkout this Dotfiles Repo locally:
git clone [email protected]:abarrows/dotfiles.git
Navigate to the root folder of the above project and using the command line run:
git submodule add https://github.com/anishathalye/dotbot
sudo chmod -R 755 /usr/local/share/zsh
./install
After the script runs, what exactly did it do and why does it matter?
- Dotenv
- Machine level sensitive variables - All application potentially has sensitive values
- iTerm 2
- .zshrc
- Agnoster Theme (Starship is Optional. See shell/.theme.sh for details.)
- Plugins
- Aliases
- Custom Bash Functions
- .zshrc
- Git configuration and defaults
- General Settings and Configurations
- Repo Templates
- Workflow Templates
- Issue Templates
- General Settings and Configurations
- Homebrew
- Default recipes
- Default casks (iOS apps)
- Node
- NVM Version Manager
- Yarn
- Global NPM Packages
- VS Code (Machine Level)
- .devcontainer. and .vscode - Development Environment IDE General Settings and project agnostic configuration/linting/tooling. IE: Things like:
- Settings.json
- Theme
- Keybindings
- Extensions
- Code Quality Tools
- Linting
- Productivity
- Formatters
- Workload integrations (JIRA/Github/Etc.)
- VS Code - General Code Quality Tools
- .editorconfig
- package.json (Everything I work on has js and related dependencies)
- Eslint
- Stylelint
- Prettier
- Shell Checker
- YAML Lint
- JSON Lint/Sorting
- VS Code - Project/Technology Specific
- workspace environment - Workspace Environment for the specific tech stack.
- IE: RoR, Next.js, etc. This will contain any overrides/modifications to:
The following tools can be used for improving the confidence of this apps logic and code.
-
Fasterer gem - DESCRIPTION: Performance analyzer for ruby | DEPENDENCIES:
gem install fasterer
| COMMAND: fasterer -
Flay gem - DESCRIPTION: This is the "DRY machine" for our code | DEPENDENCIES:
gem install flay
| COMMAND: flay -v --diff -
Reek gem - DESCRIPTION: Code Quality Analyzer. This looks for bad code smells and informs you of them. | DEPENDENCIES:
gem install reek
| OUTPUT: /coverage/reek/ COMMAND: rake reek -
Rails Best Practices - DESCRIPTION: Looks at the best practices and can advise on how to fix them | DEPENDENCIES:
gem install rails_best_practices
| COMMAND:rails_best_practices -f html --output-file ./coverage/rails_best_practices.html
| OUTPUT: /coverage/rails_best_practices.html -
YAML Lint gem - DESCRIPTION: This gem essentially is ESLint for YAML files. DEPENDENCIES:
brew install yamllint
and adding to $PATH. | DEPENDENCIES:gem install yamllint
| COMMAND:yamllint ./path/yaml-file-you-want-to-lint.yml
| CONFIG: ./yamllint.yml -
Better HTML - DESCRIPTION: This gem allows for greater control over html/erb formatting and enforcement of team's standards. It is more self-aware than erb in that your erb code will more correctly be compared against pure html rules and standards. It's highly customizable and can be configured to enforce custom team rules: IE: Do not use 'js-' prefixed classes. DEPENDENCIES:
gem install better_html
| CONFIGURATION:./config/initializers/.better-html.yml
| USAGE:-
- Include this line below the class declaration in your
application_helper.rb:
include BetterHtml::Helpers
- Include this line below the class declaration in your
application_helper.rb:
-
-
ERB Lint - DESCRIPTION: This linter bridges the gap between html beautifier formatters and rubocop linting capabilities/auto-correct features. | DEPENDENCIES:
gem install erb_lint
, VS Code Extension: ERB Formatter/Beautify | CONFIG:./erb-lint.yml
| USAGE:-
- COMMAND: (This will scan the app and display linting errors in console) erblint --lint-all --enable-all-linters
-
- COMMAND: (This will auto-fix all errors that can be fixed) erblint --lint-all --enable-all-linters --autocorrect
-
-
Solargraph gem - (VS CODE ONLY) DESCRIPTION: This is an extension that enforces rubocop, rails best practices, fasterer, reek, erb-linting, etc. and will display the errors/warnings in real time under problems. It also offers Intellisense to Ruby, autocomplete, and much more | DEPENDENCIES:
gem install solargraph
, VS Code Extension: https://marketplace.visualstudio.com/items?itemName=castwide.solargraph | USAGE:-
bundle exec yard gems && solargraph download-core && solargraph config .
-
- Navigate to the VS Code Command Palette (CMD + Shift + P) Run command:
Restart Solargraph
- Navigate to the VS Code Command Palette (CMD + Shift + P) Run command:
-
- Open a .rb file and you should begin seeing rubocop and many of the other linters listed above) errors within the VS Code problems pane.
-
- Check the following dotfiles for ingestion or discarding:
- .phpls
- .profile
- .rnd
- .solargraph
- .vagrant.d
- .viminfo
- .vs-liveshare-keychain
- .vs-liveshare-settings.json
- Address the following to codespaces/dotfile init:
- [cd ~/ && sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"]
- Linking failed /usr/local/bin/pathChecker.sh -> /home/codespace/.codespaces/.persistedshare/dotfiles/onboarding_bin/pathChecker.sh
- ~/.gitconfig already exists but is a regular file or directory
- Add global precommit hook.
.gnupg failed to sign commit data when adding .gitconfig. I suspect this has to do with having two entities in git or homebrew managing the GPG functionality.
- Create multi-stage build for the second level above. IE: Provisioning of 1, 2a (global ide settings, linting of js, css, etc.) then 2b.This will inherit from 2a and will setup all the ruby on rails related IDE settings, linting, etc.
- Decide if the workspace level should be language/tech stack specific or application specific.
- Add the corresponding cloud machine vs code settings for each linter/tool and double check to ensure there are no other variables that need to accounted for so that a team could reliably use it EXACTLY the same.
- Document the rest of the linters/tooling
- Bullet
- Brakeman
- Simplecov
- Rack-mini-profiler
- Rubocop-performance
- Rubocop-rails
- Rubocop-rspec
- Traceroute
- Automate adding iterm profile, keymaps
- Drop zsh plugins from the initial ./install command.
During active development there are three major steps to standardizing efforts. In the following order, my code is:
- Linted and auto-fixed (Es-lint/Stylelint/YAML Lint/Etc.)
- Formatted (Editor Config then Prettier)
- Any remaining linting errors or manually fixed or formatting that I have not yet automated. IE: (Command Palette -> Sort JSON)
Some general caveats here are listed below:
- In order to prevent syntax and code breakage, I have turned off the following:
- Format on Type (Since formatting should be done before linting)
- Format on Paste (Since formatting should be done before linting)
- I am using yarn to install the following NPM packages so that linting only
lints code quality problems and doesn't bleed into the formatting of code.
(Vica versa)
- stylelint-config-prettier - This allows prettier and stylelint to "play nice" so formatting and linting do not override eachother.
- eslint-config-prettier - This allows prettier and stylelint to "play nice" so formatting and linting do not override eachother.
- To verify that both are the linting and formatting of a language is setup
correctly, I look in the bottom status bar and click on the following 3 things
to ensure it's respective config file is found and that there are no errors:
- Eslint
- Prettier (Checkmark icon showing means it's good)
- Formatting (Checkmark icon showing means it's good)