Showing 157 of 338 total issues
Function click
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
click: function() {
function clearSelection() {
if (document.selection) {
document.selection.empty();
} else if (window.getSelection) {
Function render
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const prefix = 'BraintreeCardFields';
const classNames = classnames({
[prefix]: true,
[`${prefix}--active`]: this.props.isActive,
Function configureWysiwyg
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function configureWysiwyg(id, editorOptions = []) {
const $editor = $('#' + id);
if ($editor.length === 0) {
return;
}
Function configureStore
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const configureStore = (data, dispatch) => {
const search = qs.parse(location.search, {
arrayFormat: 'bracket',
});
dispatch({
Function submit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
submit(event) {
if (event) event.preventDefault();
const donationAmount = this.props.amount;
this.resetErrors();
Function SearchByPostcode
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const SearchByPostcode = props => {
const [loading, setLoading] = useState(false);
const [error, setError] = useState(false);
const [postcode, setPostcode] = useState(null);
const [input, setInput] = useState('');
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { errors } = this.state;
return (
<div>
{this.props.title && <h1> {this.props.title} </h1>}
Function constructor
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
const lang = window.champaign.page.language_code;
this.state = {
hostedFields: null,
Function init
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const init = options => {
if (!options.el) {
options.el = document.getElementById('email-tool-component');
}
const { el, store } = options;
Function Thermometer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function Thermometer(props) {
// Only render if active
if (isEmpty(props) || !props.active) return null;
const currency = props.currency;
const goal = props.goals[currency];
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { consented, showConsentRequired } = this.props;
const wrapperClass = classnames('ConsentControls', {
warning: showConsentRequired,
});
Method choices_is_valid
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def choices_is_valid
return if choices.nil?
if choices.class != Array
errors.add(:choices, 'must be an array of options')
- 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 reducer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const reducer = (state = initialState, action) => {
switch (action.type) {
case 'email_target:change_submitting':
return { ...state, isSubmitting: action.submitting };
case 'email_target:change_country':
Function PopupMemberConsent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function PopupMemberConsent(props: IProps) {
const member = useSelector((state: IAppState) => state.member);
const onClose = () => props.toggleModal(false);
const onConsent = e => {
e.preventDefault();
Function getErrorsByCode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function getErrorsByCode(code) {
let errors = [];
switch (code) {
case '':
case undefined:
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="SelectPensionFund">
<FormGroup>
<SelectCountry
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (!this.props.member || !this.props.isRequiredExisting) return null;
return (
<Popup
open={this.props.open}
Method search_by_plugin_type
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def search_by_plugin_type(query)
matches_by_plugins = []
filtered_pages = @collection.pluck(:id)
query.each do |plugin_type|
begin
- 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
Method create_action
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_action
action_params = {
page: page
}.merge(@extra_attrs)
Function renderField
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderField(type) {
const fieldProps = this.fieldProps();
const {
field: { default_value, name, choices },
} = this.props;