Showing 41 of 110 total issues
Function fetchRequests
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetchRequests(beforeFetchDispatchedAction, onSuccessFetch) {
return async (dispatch, getState) => {
const {
foiRequests: { filter },
authentication: { userId },
Function _onPress
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_onPress(x) {
if (this.state.collapsed === x) {
this.setState(
{
prevCollapsed: x,
Function navigationOptions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
FoiRequestsWebView.navigationOptions = props => {
const url = props.navigation.state.params.uri;
function share() {
Share.share(
Function navigationOptions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
PdfViewer.navigationOptions = props => {
const { url } = props.navigation.state.params;
function share() {
Share.share(
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const size = Platform.OS === 'ios' ? 35 : 26; // for icon
const { search } = this.state;
return (
<View style={styles.background} keyboardShouldPersistTaps="handled">
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
isPending,
error,
publicBody,
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
navigateToPdfViewer,
navigateToPublicBody,
isPending,
Function getCurrentAccessTokenOrRefresh
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getCurrentAccessTokenOrRefresh = (dispatch, getState) => {
return new Promise(async (resolve, reject) => {
const {
timeStamp,
expiresIn,
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { filterUser, currentUserId, filterFollower } = this.props;
let secondIcon = null;
if (filterUser != null) {
Function getFromCacheOrFetch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getFromCacheOrFetch(url, additionalHeaders = {}) {
return new Promise((resolve, reject) => {
cache
.get(url)
.then(value => {
Function mapDispatchToProps
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const mapDispatchToProps = dispatch => {
return {
navigateToAboutApp: () =>
dispatch(NavigationActions.navigate({ routeName: 'ProfileAboutApp' })),
navigateToIntroVideo: () =>
Function fetchInitialToken
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const fetchInitialToken = url => {
return new Promise(async (resolve, reject) => {
const paramString = url.substr(OAUTH_REDIRECT_URI.length);
const params = getParams(paramString);
- 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 getCurrentAccessTokenOrRefresh
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getCurrentAccessTokenOrRefresh = (dispatch, getState) => {
return new Promise(async (resolve, reject) => {
const {
timeStamp,
expiresIn,
- 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 render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const { filterUser, currentUserId, filterFollower } = this.props;
let secondIcon = null;
if (filterUser != null) {
- 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 fetchAndDispatch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
buildUrl,
dispatch,
beforeFetch,
onSuccessFetch,
onErrorFetch,
Function search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function search(state = initialState, action) {
switch (action.type) {
case 'SEARCH_FOI_REQUESTS_ERROR':
return {
...state,
- 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 fetchMultipleAndDispatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
urls,
dispatch,
beforeFetch,
onSuccessFetch,
onErrorFetch
Function toggleFollow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async toggleFollow() {
try {
const {
id,
getAccessToken,
- 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
Avoid too many return
statements within this function. Open
return { ...state, alerts };
Avoid too many return
statements within this function. Open
return { ...state, pastAlertMatches };