Showing 117 of 254 total issues
Function initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function ( options ) {
var that = this,
fieldName = options.input.name;
this.$input = $( options.input );
Method check_updates
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function check_updates( $data ) {
static $response = null;
$request = rwmb_request();
Function click .button
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
'click .button': function () {
if ( this._frame ) {
this._frame.dispose();
}
var maxFiles = this.controller.get( 'maxFiles' );
Method html
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function html( $meta, $field ) {
$meta = array_filter( (array) $meta );
$i18n_more = apply_filters( 'rwmb_file_add_string', _x( '+ Add new file', 'file upload', 'meta-box' ), $field );
$html = self::get_uploaded_files( $meta, $field );
Method file_info
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function file_info( $file, $args = [], $field = [] ) {
$path = get_attached_file( $file );
if ( ! $path ) {
return false;
}
Method normalize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function normalize( $field ) {
$field = wp_parse_args( $field, [
'timestamp' => false,
'inline' => false,
'js_options' => [],
Function initialize
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize: function ( options ) {
this.controller = options.controller;
this.collection = this.controller.get( 'items' );
this.itemView = options.itemView || MediaItem;
this.getItemView = _.memoize( function ( item ) {
Function addNew
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addNew() {
const $this = $( this );
$this.rwmbModal( {
removeElement: '#editor .interface-interface-skeleton__footer, .edit-post-fullscreen-mode-close',
Function transport
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
options.ajax.transport = function ( params, success, failure ) {
if ( params.data._type === 'query' ) {
delete params.data.page;
}
Method rules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rules( RW_Meta_Box $meta_box ) {
$settings = $meta_box->meta_box;
if ( empty( $settings['validation'] ) ) {
return;
}
Function displayMap
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function displayMap() {
var osmTileLayer = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
} );
var options = $( this ).data( 'osm_options' ),
Method ajax_delete_file
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function ajax_delete_file() {
$request = rwmb_request();
$field_id = (string) $request->filter_post( 'field_id' );
$type = str_contains( $request->filter_post( 'field_name' ), '[' ) ? 'child' : 'top';
check_ajax_referer( "rwmb-delete-file_{$field_id}" );
Function check_updates
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function check_updates( $data ) {
static $response = null;
$request = rwmb_request();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function enqueue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function enqueue() {
if ( is_admin() && ! $this->is_edit_screen() && ! $this->is_gutenberg_screen() ) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function save( $new, $old, $post_id, $field ) {
if ( empty( $field['id'] ) || ! $field['save_field'] ) {
return;
}
$name = $field['id'];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function meta
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function meta( $post_id, $saved, $field ) {
/**
* For special fields like 'divider', 'heading' which don't have ID, just return empty string
* to prevent notice error when displaying fields.
*/
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function replace
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
replace: function ( index, value, before, after, alternative, isEnd ) {
Function get_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function get_value( $field_id, $object_id, $atts ) {
// If we pass object_id via shortcode, we need to make sure current user
// has permission to view the object
if ( ! is_null ( $object_id ) ) {
$has_object_permission = $this->check_object_permission( $object_id, $atts );
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function save() {
$request = rwmb_request();
if ( ! $request->post( 'submit' ) ) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function normalize_icon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static function normalize_icon( array $field, $key, $icon ): array {
// Default: Font Awesome Free.
if ( $field['icon_set'] === 'font-awesome-free' ) {
$style = $icon['styles'][0];
return [
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"