appbaseio/dejaVu

View on GitHub

Showing 201 of 201 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            {(indexes.length <= 1 || !isConnected) && (
                <Item key="preview">
                    <ExperimentOutlined />
                    <span>Search Preview</span>
                </Item>
Severity: Major
Found in packages/dejavu-main/app/src/components/Navigation.js and 1 other location - About 1 hr to fix
packages/dejavu-main/app/src/components/Navigation.js on lines 78..83

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 58.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

            {(indexes.length <= 1 || !isConnected) && (
                <Item key="query">
                    <SearchOutlined />
                    <span>Query Explorer</span>
                </Item>
Severity: Major
Found in packages/dejavu-main/app/src/components/Navigation.js and 1 other location - About 1 hr to fix
packages/dejavu-main/app/src/components/Navigation.js on lines 84..89

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 58.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const APPS = {
    LOAD: 'APPS_LOAD',
    LOAD_SUCCESS: 'APPS_LOAD_SUCCESS',
    LOAD_FAIL: 'APPS_LOAD_FAIL',
    LOAD_METRICS_SUCCESS: 'APPS_LOAD_METRICS_SUCCESS',
Severity: Major
Found in packages/browser/src/constants/index.js and 1 other location - About 1 hr to fix
packages/dejavu-main/app/src/constants/index.js on lines 54..65

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 58.

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

Further Reading

Function fetchMappings has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const fetchMappings = async (appname, rawUrl) => {
    const defaultError = 'Unable to fetch mappings';
    try {
        const { url } = parseUrl(rawUrl);
        const headers = getHeaders(rawUrl);
Severity: Minor
Found in packages/browser/src/apis/mappings.js - About 1 hr to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if (Array.isArray(queryData)) {
                query = {
                    query: {
                        ids: {
                            values: queryData,
    Severity: Major
    Found in packages/browser/src/apis/data.js and 1 other location - About 1 hr to fix
    packages/browser/src/apis/data.js on lines 116..128

    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 57.

    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

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if (Array.isArray(queryData)) {
                query = {
                    query: {
                        ids: {
                            values: queryData,
    Severity: Major
    Found in packages/browser/src/apis/data.js and 1 other location - About 1 hr to fix
    packages/browser/src/apis/data.js on lines 194..206

    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 57.

    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

    Further Reading

    Function Navigation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    const Navigation = ({ indexes, isConnected, history }: Props) => {
        const [selectedKey, setSelectedKey] = useState('browse');
    
        useEffect(() => {
            const routeName = window.location.pathname.substring(1);
    Severity: Minor
    Found in packages/dejavu-main/app/src/components/Navigation.js - About 1 hr to fix

    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 getAnalyzersApi has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    export const getAnalyzersApi = async (rawUrl, indexName) => {
        const defaultError = 'Unable to get version';
        try {
            const { url } = parseUrl(rawUrl);
            const headers = getHeaders(rawUrl);
    Severity: Minor
    Found in packages/browser/src/apis/analyzers.js - About 1 hr to fix

    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 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render() {
            const { isConnected } = this.props;
            const { url, isProcessingUrl } = this.state;
    
            return (
    Severity: Minor
    Found in packages/dejavu-main/app/src/components/QueryExplorer.js - About 1 hr to fix

      Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render() {
              const { mode } = this.props;
      
              return (
                  <Select
      Severity: Minor
      Found in packages/browser/src/components/DataBrowser/ModeSwitch.js - About 1 hr to fix

        Function app has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const app = (state = initialState, action) => {
            const { appname, url, type, headers } = action;
            switch (type) {
                case APP.CONNECT_REQUEST:
                    return {
        Severity: Minor
        Found in packages/browser/src/reducers/app.js - About 1 hr to fix

          Function render has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render() {
                  const { isShowingDetails } = this.state;
                  const { description, handleReload } = this.props;
                  return (
                      <Fragment>
          Severity: Minor
          Found in packages/browser/src/components/ErrorFlashMessage/ErrorMessage.js - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                toggleModal = () => {
                    this.setState(prevState => ({
                        isShowingModal: !prevState.isShowingModal,
                    }));
                    this.props.setMode(MODES.EDIT);
            Severity: Major
            Found in packages/browser/src/components/DataBrowser/AddRowModal.js and 1 other location - About 1 hr to fix
            packages/browser/src/components/DataBrowser/AddFieldModal.js on lines 223..228

            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 56.

            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

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                toggleModal = () => {
                    this.setState(prevState => ({
                        isShowingModal: !prevState.isShowingModal,
                    }));
                    this.props.setMode(MODES.EDIT);
            packages/browser/src/components/DataBrowser/AddRowModal.js on lines 179..184

            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 56.

            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

            Further Reading

            Function getNestedArrayField has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const getNestedArrayField = (data, mappings) => {
                const fieldsToBeDeleted = {};
                const parentFields = {};
                const indexTypeMap = {};
                data.forEach(dataItem => {
            Severity: Minor
            Found in packages/browser/src/utils/mappings.js - About 1 hr to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const nestedColumns = (state = false, action) => {
                  const { isShowingNestedColumns } = action;
                  switch (action.type) {
                      case NESTED_COLUMNS.SET_IS_SHOWING_NESTED_COLUMNS:
                          return isShowingNestedColumns;
              Severity: Major
              Found in packages/browser/src/reducers/nestedColumns.js and 2 other locations - About 1 hr to fix
              packages/browser/src/reducers/applyQuery.js on lines 3..11
              packages/browser/src/reducers/selectAll.js on lines 3..11

              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 55.

              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

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const applyQueryReducer = (state = false, action) => {
                  const { applyQuery } = action;
                  switch (action.type) {
                      case APPLY_QUERY.SET_APPLY_QUERY:
                          return applyQuery;
              Severity: Major
              Found in packages/browser/src/reducers/applyQuery.js and 2 other locations - About 1 hr to fix
              packages/browser/src/reducers/nestedColumns.js on lines 3..11
              packages/browser/src/reducers/selectAll.js on lines 3..11

              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 55.

              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

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

              const selectAllReducer = (state = false, action) => {
                  const { selectAll } = action;
                  switch (action.type) {
                      case SELECT_ALL.SET_SELECT_ALL:
                          return selectAll;
              Severity: Major
              Found in packages/browser/src/reducers/selectAll.js and 2 other locations - About 1 hr to fix
              packages/browser/src/reducers/applyQuery.js on lines 3..11
              packages/browser/src/reducers/nestedColumns.js on lines 3..11

              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 55.

              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

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                                  newApps.push({
                                      appname,
                                      url,
                                      headers: customHeaders.filter(
                                          item => item.key.trim() && item.value.trim(),
              Severity: Major
              Found in packages/browser/src/components/ConnectApp/ConnectApp.js and 1 other location - About 1 hr to fix
              packages/browser/src/components/ConnectApp/ConnectApp.js on lines 327..333

              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 55.

              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

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              const versionReducer = (state = 5, action) => {
                  const { version } = action;
                  switch (action.type) {
                      case VERSION.SET_VERSION:
                          return version;
              Severity: Major
              Found in packages/browser/src/reducers/version.js and 1 other location - About 1 hr to fix
              packages/browser/src/reducers/pageSize.js on lines 3..11

              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 55.

              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

              Further Reading

              Severity
              Category
              Status
              Source
              Language