Commit Graph
138 Commits
Author SHA1 Message Date
Grzegorz Bizon a55e8f109f Enable Style/NegatedIf Rubocop cop
Favor `unless` over `if` for negative conditions
(or control flow ||).

See #17478
2016-05-30 13:53:25 +02:00
Robert Speicher 3c2d0cf24c Merge branch 'complexity/enable-multiple-rubocop-cops-2' into 'master'
Enable multiple compatible Rubocop cops

## What does this MR do?

This MR enables multiple Rubocop cops, that are already compatible with
our codebase. See #17406.

Cops enabled:

```text
Style/ArrayJoin:
  Description: Use Array#join instead of Array#*.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
----------------
Style/Attr:
  Description: Checks for uses of Module#attr.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
----------------
Style/BlockComments:
  Description: Do not use block comments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
----------------
Style/ClassMethods:
  Description: Use self when defining module/class methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-class-methods
----------------
Style/EndBlock:
  Description: Avoid the use of END blocks.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks
----------------
Style/EvenOdd:
  Description: Favor the use of Fixnum#even? && Fixnum#odd?
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
----------------
Style/FileName:
  Description: Use snake_case for source file names.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
  ExpectMatchingDefinition: false
----------------
Style/FirstMethodParameterLineBreak:
  Description: Checks for a line break before the first parameter in a multi-line method
    parameter definition.
----------------
Style/FlipFlop:
  Description: Checks for flip flops
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
----------------
Style/GlobalVars:
  Description: Do not introduce global variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
  Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
----------------
Style/IfWithSemicolon:
  Description: Do not use if x; .... Use the ternary operator instead.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
----------------
Style/LambdaCall:
  Description: Use lambda.call(...) instead of lambda.(...).
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
  EnforcedStyle: call
----------------
Style/MethodName:
  Description: Use the configured style when naming methods.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/MultilineMethodDefinitionBraceLayout:
  Description: Checks that the closing brace in a method definition is symmetrical with
    respect to the opening brace and the method parameters.
----------------
Style/NestedModifier:
  Description: Avoid using nested modifiers.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-modifiers
----------------
Style/OpMethod:
  Description: When defining binary operators, name the argument other.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
----------------
Style/SignalException:
  Description: Checks for proper usage of fail and raise.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#prefer-raise-over-fail
  EnforcedStyle: only_raise
----------------
Style/SpaceAfterNot:
  Description: Tracks redundant space after the ! operator.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-bang
----------------
Style/SpaceBeforeSemicolon:
  Description: No spaces before semicolons.
----------------
Style/SpaceInsideRangeLiteral:
  Description: No spaces inside range literals.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals
----------------
Style/SpaceInsideStringInterpolation:
  Description: Checks for padding/surrounding spaces inside string interpolation.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#string-interpolation
  EnforcedStyle: no_space
----------------
Style/StabbyLambdaParentheses:
  Description: Check for the usage of parentheses around stabby lambda arguments.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#stabby-lambda-with-args
  EnforcedStyle: require_parentheses
----------------
Style/StringMethods:
  Description: Checks if configured preferred methods are used over non-preferred.
  PreferredMethods:
    intern: to_sym
----------------
Style/VariableInterpolation:
  Description: Don't interpolate global, instance and class variables directly in strings.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
----------------
Style/VariableName:
  Description: Use the configured style when naming variables.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
  EnforcedStyle: snake_case
----------------
Style/WhenThen:
  Description: Use when x then ... for one-line cases.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
----------------
Style/WhileUntilModifier:
  Description: Favor modifier while/until usage when you have a single-line body.
  StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
  MaxLineLength: 80
```

Closes #17406 

See merge request !4286
2016-05-25 19:41:10 +00:00
Grzegorz Bizon 2c7439db4d Enable multiple compatible Rubocop cops
Closes #17406
2016-05-25 06:17:29 +02:00
Kamil Trzcinski cdec9e472d Replace \n to <br> 2016-05-23 21:59:07 -05:00
Robert Speicher 3ba72f69af Enable Style/SpaceAroundKeyword cop and fix offenses 2016-05-23 14:16:35 -04:00
Stan Hu 9bb0d0b407 Fix Error 500 in CI charts by gracefully handling commits with no durations
Closes #17730
2016-05-22 23:52:50 -07:00
Grzegorz Bizon bf9cc351c2 Add minor corrections related to config of runner 2016-05-19 22:01:53 +02:00
Grzegorz Bizon 0fd100d28d Improve setting default runner attrs when using API 2016-05-19 22:01:53 +02:00
Grzegorz Bizon b8cf2a340b Set run untagged option when registering a runner 2016-05-19 22:01:53 +02:00
Jacob Schatz f2303f9df0 Merge branch 'send-incremental-build-log' into 'master'
Update build log incrementally

Proof of concept implementation of incremental sending of build log to browser.

cc @jschatz1 @vsizov @grzesiek @tmaczukin 


See merge request !3737
2016-05-12 16:48:42 +00:00
Rémy Coutable 5589dcf8db Fix a few places where autoloading would fail
- Fix naming of API::CommitStatuses
- Ensure we use require_dependency instead of require
- Ensure the namespace is right in lib/api/api.rb, otherwise, we
  might require Grape::API::Helpers which defines the `#params` method.
  This is to avoid requiring a file multiple times and getting an "Already
  initialized constant" error.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-05-10 11:51:19 +02:00
Kamil Trzcinski 74520f23db Encode state as base64 string 2016-05-09 20:19:27 +03:00
Kamil Trzcinski baef6728fa Send trace to a browser incrementally when build is running
We send a state of ansi2html to client, client needs to send this state back.
The state describes the configuration of generator and position within trace.
2016-05-09 19:59:45 +03:00
Tomasz Maczukin 9a1b174d5c Fix some typos 2016-04-22 22:08:38 +02:00
Tomasz Maczukin a2e2989637 Modify code formatting 2016-04-22 22:08:37 +02:00
Tomasz Maczukin 0ccf629525 Simplify the GitlabCiYamlProcessor#initial_parsing method 2016-04-22 22:08:36 +02:00
Tomasz Maczukin 8dd27b47ea Add posibility to define a hidden job without 'script' in .gitlab-ci.yml 2016-04-22 22:08:34 +02:00
Kamil Trzciński d240666800 Merge branch 'ci-commit-as-pipeline' into 'master'
Ci::Commit becomes a Pipeline object

1. Ci::Commit receives context: ref, :tag.
1. One Ci::Commit describes a one Pipeline
1. Pipeline is created from `.gitlab-ci.yml`
1. Pipeline is a ordered group of builds
1. We test MR against Pipeline
1. Pipelines have a separate view (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703)
1. Pipeline can be triggered from UI (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703)
1. Later we change `Trigger -> TriggerRequest -> Build` to `Trigger -> Pipeline` (future)
1. We add a Pipeline Hook that will be triggered on Pipeline status change  (future)
1. We extend notifications to use `Pipeline Hook` to send summary on pipeline changes (future)

After merging that I'll prepare a separate MR that will unify naming, database columns, table names:
```
Ci::Commit -> Pipeline
Ci::Build -> Build
CommitStatus -> Job
GenericCommitStatus -> ExternalJob

ci_commits -> pipelines
ci_builds -> jobs
```

This MR implements first 5 points.

This is made to solve this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/14149.

See merge request !3653
2016-04-21 08:10:37 +00:00
Tomasz Maczukin a84d0204bf Fix Build#append_trace method usage when trace file doesn't exists yet 2016-04-20 11:54:06 +02:00
Tomasz Maczukin 4019b0d872 Fix some typos in documentation
[ci skip]
2016-04-20 11:54:06 +02:00
Tomasz Maczukin 0725c28069 Add documentation of incremental trace update API
[ci skip]
2016-04-20 11:54:05 +02:00
Tomasz Maczukin dd29283a88 Make sure that appending is done on a valid length 2016-04-20 11:53:44 +02:00
Tomasz Maczukin 360bd831bf Add range checking 2016-04-20 11:53:43 +02:00
Tomasz Maczukin 38a1378e63 Add incremental build trace update API 2016-04-20 11:53:39 +02:00
Kamil Trzcinski 27e0c7723c Merge remote-tracking branch 'origin/master' into ci-commit-as-pipeline
# Conflicts:
#	db/schema.rb
2016-04-19 14:00:14 -04:00
Kamil Trzcinski 3f66f4470a Make rubocop happy 2016-04-18 15:19:24 -04:00
Kamil Trzcinski 9a2685fae0 Merge branch 'after-script' into make-before-after-overridable 2016-04-18 10:20:51 -04:00
Kamil Trzcinski 0ce5cc9962 Resolve merge 2016-04-18 10:19:29 -04:00
Kamil Trzcinski 2ab8d3e652 Merge branch 'after-script' into make-before-after-overridable 2016-04-18 09:47:12 -04:00
Kamil Trzcinski aca1e14bd3 Merge remote-tracking branch 'origin/master' into after-script 2016-04-18 09:46:12 -04:00
Kamil Trzcinski 42102b4344 Merge branch 'after-script' into make-before-after-overridable 2016-04-18 07:53:21 -04:00
Kamil Trzcinski 63bd1f92d9 Fix rubocop complains 2016-04-18 07:51:49 -04:00
Grzegorz Bizon 1339fda1cd Minor refactorings in CI config 2016-04-18 13:36:52 +02:00
Grzegorz Bizon 2b1c08be8f Validate job-level variables in YAML config file 2016-04-18 13:17:48 +02:00
Grzegorz Bizon cf3e3effb0 Minor refactoring in code related to job variables 2016-04-18 13:17:48 +02:00
Grzegorz Bizon 1f3248644e Make CI config return empty array if no job variables 2016-04-18 13:17:48 +02:00
Grzegorz Bizon 3dec6e2629 Rename method that returns global envs in CI conf 2016-04-18 13:17:48 +02:00
Grzegorz Bizon b7946b50fc Read job variables directly from gitlab CI config 2016-04-18 13:17:48 +02:00
Grzegorz Bizon a1363d39c6 Add variables keyword to job in CI config YAML 2016-04-18 13:17:47 +02:00
Kamil Trzcinski 5a7e4dfd33 Merge branch 'after-script' into make-before-after-overridable
* after-script:
  Add CHANGELOG and documentation
  Rename finally_script to after_script

Conflicts:
	lib/ci/gitlab_ci_yaml_processor.rb
	spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
2016-04-17 09:06:55 -04:00
Kamil Trzcinski cc57d61023 Rename finally_script to after_script 2016-04-17 08:59:57 -04:00
Kamil Trzcinski 4cc9a02ee0 Allow the before_script and finally_script to be overwritten in context of job 2016-04-16 19:22:49 +02:00
Kamil Trzcinski b340b59743 Implement finally_script which allows to do cleanups as part of the build process 2016-04-16 19:22:48 +02:00
Kamil Trzcinski 1ae797c229 Fix create_next_builds method 2016-04-12 11:15:19 +02:00
Kamil TrzcinskiandRémy Coutable 8fac12c590 Fix build dependencies, when the dependency is a string 2016-03-23 12:55:23 +01:00
Jason Roehm 5adaabdd30 make conditional a bit clearer 2016-03-15 21:28:06 -04:00
Jason Roehm 588002d8c7 fixed missing argument in list 2016-03-15 11:03:00 -04:00
Jason Roehm c57c9c41e0 fix rubocop violation 2016-03-15 09:47:47 -04:00
Jason Roehm a8f1c5ed03 add 'triggers' keyword to gitlab-ci.yml 'only' and 'except' fields to allow control over whether triggers will cause jobs to run 2016-03-15 09:27:33 -04:00
Kamil Trzcinski 388f69b0de Merge remote-tracking branch 'origin/master' into gitlab-ci-yaml-updates
# Conflicts:
#	spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
2016-03-11 14:22:49 +01:00