Code Monkey home page Code Monkey logo

codingstyle's Introduction

JoliCode coding style

This repository host common boilerplate configuration files for our web projects. They are opinionated by nature, and may not be right for you.

Installation on the host system (one time)

  • Install EditorConfig plugin (required for PhpStorm, Atom...);
  • Use the .gitconfig file as a base for your local git setting (to copy in ~/.gitconfig).

Installation on the project (on each project)

  • Inside your project, run the following command:
wget -qO- https://github.com/jolicode/codingstyle/archive/master.tar.gz | tar xvz --strip-components=1
  • edit all appname in the new files, and make sure to adapt them to your needs.

Usage

Fix Coding Standard

make cs

codingstyle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codingstyle's Issues

[RFC] PHP Coding standard

So, what are our PHP CS? What should we follow?

  • we generally follow Symfony CS: so it's PSR-0, PSR-1, PSR-2 and PSR-4;
  • Symfony CS are supported in PHP-CS-Fixer out of the box;
  • Symfony CS are available as a Code Sniffer sniffer: https://github.com/M6Web/Symfony2-coding-standard
  • there is no PSR for variable naming (only Class and method) as far as I know. We should make sure we follow some rules;
  • there is nothing about translation key standard neither in those tools, but I think this is important; There are no tools able to fix or check thoses for us, but defining a standard will help;

Questions, food for thought?

  • Also, should we rely on http://editorconfig.org/ for PHP? Maybe both are needed;
    • if yes, we must use a PSR2 compatible config (follow "There MUST NOT be a hard limit on line length; the soft limit MUST be 120 characters; lines SHOULD be 80 characters or less." for example);
  • Should we use coke to ensure the standards are followed? Red build if CS are bad;

Already in use example

Some of our project use those as .php_cs:

<?php

$header = <<<EOF
This file is part of the *** Project.

(c) *** <contact@***.com>
EOF;

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);

$finder = Symfony\CS\Finder\DefaultFinder::create()
    ->in(array(__DIR__.'/src', __DIR__.'/app/Resources'))
;

return Symfony\CS\Config\Config::create()
    ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
    ->fixers(array(
        'header_comment',
        '-unalign_double_arrow',
        '-unalign_equals',
        'align_double_arrow',
        'newline_after_open_tag',
        'ordered_use',
        'short_array_syntax',
    ))
    ->setUsingCache(true)
    ->finder($finder)
;

I propose myself as a lead on the PHP standard initiative for JoliCode, this issue aims at starting the conversation and gather feedback from everyone interested. Cheers ๐Ÿป

[RFC] Add some default github template for PR / Issues?

As github is on ๐Ÿ”ฅ since the "dear github" letter, they ship a lots of feature, and one of them is issue/PR template: https://github.com/blog/2111-issue-and-pull-request-templates

We could benefit from a good default in our projects, as it's very common to read crappy junk PR, without any description other than the commit message (yeah thx for nothing), no deployment infos, no "how to test", no link to the original issue...

We also don't have a common way to communicate a PR status (WIP in the title, a "do not merge plz" somewhere, etc).

Here is a good example of what I want: https://gist.github.com/Lordnibbler/11002759

[RFC] Git standard configuration

Should we establish a default configuration for git? Everybody would be free to use it / customize it / or discard it completly but this default config would probably be useful for newcomers. Something among:

~/.gitconfig

[core]
    excludesfile = ~/.gitignore
[alias]
    st = status
    df = diff
    co = checkout
    ci = commit
    br = branch
    lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

[branch]
    autosetuprebase = always

~/.gitignore

.idea
.DS_Store
._*
.Spotlight-V100
.Trashes
.buildpath
.project
.settings

What do you think?

[RFC] Some default composer options?

Just stubbed upon the sort-packages option in composer,
it make the list of required package always sorted alphabetically โœจ

What do you think?

Any other option we should add?

  • notify-on-install: false
  • bin-dir: "bin"

And the prefer-stable flag?

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.