Showing 80 of 80 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');
$table->tinyInteger('attempts')->unsigned();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 124.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');
$table->tinyInteger('attempts')->unsigned();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 124.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function makeInvokeMethod
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
Function invoke
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
}
Method update
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update(ItemUpdateRequest $request, Item $item)
{
/** @var \App\Models\User $user */
$user = auth()->user();
if ($item->published()) {
Function exports
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
var head, last, notify;
var flush = function () {
var parent, fn;
Function exports
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
$iterCreate(Constructor, NAME, next);
var getMethod = function (kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
Function maybeInvokeDelegate
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
Method store
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function store(ItemStoreRequest $request)
{
DB::transaction(function () use ($request) {
$brand = Brand::findOrFail($request->brand);
$category = Category::findOrFail($request->category);
Function notify
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
var notify = function (promise, isReject) {
if (promise._n) return;
promise._n = true;
var chain = promise._c;
microtask(function () {
Function dispatchRequest
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function dispatchRequest(config) {
throwIfCancellationRequested(config);
// Support baseURL config
if (config.baseURL && !isAbsoluteURL(config.url)) {
Function dispatchException
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
Function main
has 67 lines of code (exceeds 50 allowed). Consider refactoring. Open
func main() {
g := generator.New()
t, err := template.New("protoc-gen-router").Parse(tmpl)
if err != nil {
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
Function AsyncIterator
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AsyncIterator(generator) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
Function $export
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
Function clearSelectedFilters
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
clearSelectedFilters: function () {
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(lens) {
var _updateQueryString;
return _regenerator2.default.wrap(function _callee$(_context) {
Method apply
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function apply(Request $request, $query, $value)
{
// lock away certain functions behind dev.
if ($request->user()->developer()) {
switch ($value) {
Function buildURL
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function buildURL(url, params, paramsSerializer) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
Method fields
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fields(Request $request)
{
return [
Gravatar::make(),